Difference between revisions of "Pandora - Sample - Update Fields on UTA Record"
(Created page with '==Sample Code - Updating Fields on a UTA Record== The following function can be used to update a given field to the database without actually saving the page. This can be usefu…') |
|||
Line 13: | Line 13: | ||
<PRE> | <PRE> | ||
function updatefields(fieldname,fielddata){ | function updatefields(fieldname,fielddata){ | ||
− | ss_developer_key=" | + | ss_developer_key="123456-yFNRjOyOB1234567890tPobcei4ZPcX5sYeeys52g="; |
var appid='123456'; //the application ID of the relevant UTA | var appid='123456'; //the application ID of the relevant UTA | ||
var addfields="opportunityid,"+fieldname; | var addfields="opportunityid,"+fieldname; |
Revision as of 13:30, 19 August 2010
Contents
Sample Code - Updating Fields on a UTA Record
The following function can be used to update a given field to the database without actually saving the page.
This can be useful when triggering a workflow using a script, if the given field value is required in the workflow e-mail (for example) if the script will trigger the workflow prior to the record being saved. It can also be useful for a field that is not visible or editable to the user viewing the record that needs to be updated in certain circumstances.
Pandora Function
Level 1
This function updates the database with the field(s) passed so that the new data is saved to the server when workflows are triggered by the scripts on this page.
function updatefields(fieldname,fielddata){ ss_developer_key="123456-yFNRjOyOB1234567890tPobcei4ZPcX5sYeeys52g="; var appid='123456'; //the application ID of the relevant UTA var addfields="opportunityid,"+fieldname; var rset=new ssRecordSet(null); rset.addfieldnames(addfields); var idx=rset.getnewrecnumber(); rset.addfieldvaluebyname(idx,'opportunityid','@opportunityid@'); rset.addfieldvaluebyname(idx,fieldname,fielddata); var rs=levelone_update(false ,'',appid,rset); }
Level 2
This function updates the database with the field(s) passed so that the new data is saved to the server when workflows are triggered by the scripts on this page.
function updatefields(fieldname,fielddata){ ss_developer_key="12345-lasdhaldkvhj”; var appid='123456'; //the application ID of the relevant UTA var addfields="eventid,"+fieldname; var rset=new ssRecordSet(null); rset.addfieldnames(addfields); var idx=rset.getnewrecnumber(); rset.addfieldvaluebyname(idx,'eventid','@eventid@'); rset.addfieldvaluebyname(idx,fieldname,fielddata); var rs=level23_update(false ,'',appid,2,rset); for level 3 use: level23_update(false ,'',appid,3,rset); }
Sample calls to the function from another script
updatefields("cf_1742399",frm.cf_1742399.value);
or
updatefields("assigned","@me.userid@");