Difference between revisions of "Populating Auto Number Custom Fields with Pandora"

From SmartWiki
Jump to: navigation, search
(Created page with ' When updating an Auto Number custom field using Pandora you have 2 options: 1) Populate the actual value with Pandora 2) Prompt the SmartSimple server to assign the value b…')
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
 
When updating an [[Auto Number]] custom field using Pandora you have 2 options:
 
When updating an [[Auto Number]] custom field using Pandora you have 2 options:
 
+
<!--autonumber-->
1) Populate the actual value with Pandora
+
# Populate the actual value with Pandora
2) Prompt the SmartSimple server to assign the value based on the next value configured on the [[Auto Number]] custom field setting.
+
# Prompt the SmartSimple server to assign the value based on the next value configured on the [[Auto Number]] custom field setting.
  
  
Line 24: Line 23:
 
                 rset.addfieldnames("eventid,cf_a1234713");
 
                 rset.addfieldnames("eventid,cf_a1234713");
 
                 var idx=rset.getnewrecnumber();   
 
                 var idx=rset.getnewrecnumber();   
 
+
 
 
                 rset.addfieldvaluebyname(idx,'eventid',eventid);
 
                 rset.addfieldvaluebyname(idx,'eventid',eventid);
 
                 rset.addfieldvaluebyname(idx,'cf_a1234713','ignore');
 
                 rset.addfieldvaluebyname(idx,'cf_a1234713','ignore');

Latest revision as of 11:18, 8 April 2016

When updating an Auto Number custom field using Pandora you have 2 options:

  1. Populate the actual value with Pandora
  2. Prompt the SmartSimple server to assign the value based on the next value configured on the Auto Number custom field setting.


For the first option, the values are added directly by the javascript code, just like any other custom field that stores data. To update custom field with ID 1234713 with number "7500" the following code would be used:

                rset=new ssRecordSet(null);
                rset.addfieldnames("eventid,cf_1234713");
                var idx=rset.getnewrecnumber();
 
                rset.addfieldvaluebyname(idx,'eventid',eventid);
                rset.addfieldvaluebyname(idx,'cf_1234713',"7500");
     
                result=level23_update(false ,"",100022,2,rset);


For the second option you add the letter "a" in front of the fieldid. The value that you pass will be ignored, and the system will process the variables in the configuration of the Auto Number custom field to determine what value will be stored.

For example:

                rset=new ssRecordSet(null);
                rset.addfieldnames("eventid,cf_a1234713");
                var idx=rset.getnewrecnumber();   
 
                rset.addfieldvaluebyname(idx,'eventid',eventid);
                rset.addfieldvaluebyname(idx,'cf_a1234713','ignore');
     
                result=level23_update(false ,"",100022,2,rset);


Important

  • Prefixing the custom field id with the letter "a" is only appropriate if the custom field is an Auto Number field.


See Also