Changes

Jump to: navigation, search

Pandora - Sample - Updating Level 2 Items

2,437 bytes added, 21:32, 20 July 2010
no edit summary
* The code is associated with the Save function on the level 2 page.
Code <PRE>  function savefunc(frm) { fillFee(frm); return true;} function fillFee(frm){ /* Following variables must be set for each instance */ ss_developer_key="237753-xU7Kd1o2FAH/cuHfLZcTO8SdXzE3g7wmiWFPdoez/9Q="; var COMPANYTRANSACTIONTYPEID=64;//company transaction type id var GENERICTRANSACTIONCOMPANYID=479981;//company id being used for generic company transactions var PAYERFEECUSTOMFIELDID=569340;//level2 payer fee custom field id for company transaction fee found var PEOPLETRANSACTIONTYPEID=65;//people transaction type id var GENERICTRANSACTIONUSERID=0;//user id being used for generic people transactions var ASSESSORFEECUSTOMFIELDID=569377;//level 2 assessor custom field id for people transaction fee found //------------------------------END--------------------- var companyid="@parent.client.companyid@";//get level 1 client companyid var servicename=frm.eventtype.options[frm.eventtype.selectedIndex].text;//get level 2 service name and split into an array since it is a multiple level combo box custom field var criteria="trstranstype="+COMPANYTRANSACTIONTYPEID+" and trsobjectid in('"+companyid+"',"+GENERICTRANSACTIONCOMPANYID+") and $Assessment$='"+servicename+"'";//search for level 1 client company transaction var rs=trans_find(false ,"","$Schedule fee$,$Assessment$",criteria,"","","",0,1); var valuestr="0"; if(rs!=null&&rs.recordcount>0)valuestr=rs.getfieldbyname(1,"$Schedule fee$"); document.getElementById("cf_"+PAYERFEECUSTOMFIELDID).value=valuestr;//fill level 2 custom field "Payer Fee" with transaction schedule fee found var userid=frm.contact.value.replace(/^,|,$/,"");//find level 2 contact userid if (userid=="")return;//if there is no contact associated with level 2, do nothing criteria="trstranstype="+PEOPLETRANSACTIONTYPEID+" and trsobjectid in('"+userid+"',"+GENERICTRANSACTIONUSERID+")";//search for level 2 contact user transaction criteria+="and $Service Name$='"+servicename+"'";//transaction service type match level 2 service name rs=trans_find(false ,"","$Service Name$,$Fee$",criteria,"","","",0,1);//find trasaction fee according to be addedabove criteria valuestr="0"; if(rs!=null&&rs.recordcount>0)valuestr=rs.getfieldbyname(1,"$Fee$"); document.getElementById("cf_"+ASSESSORFEECUSTOMFIELDID).value=valuestr;//fill transaction fee to level 2 custom field "Assessor Flat Fee"}</script><SCRIPT type="text/javascript" language=JavaScript src="/Ajax/uta/uta.js"> </PRE>
[[Category: Pandora]]
Smartstaff
311
edits

Navigation menu