Pandora - Sample - Create Level 3 Record

From SmartWiki
Jump to: navigation, search

The following script can be placed within a Browser Script on a Level 2 record to create a Level 3 record attached to the current Level 2.

   ss_developer_key="12345-askahdidsuvnme987yud3";
   var appid=12345;
   var addfields="eventid,eventtype,statusid,objectid,objecttype,eownerid,startdate";
   var rset=new ssRecordSet(null);
   rset.addfieldnames(addfields);
   var idx=rset.getnewrecnumber();
   rset.addfieldvaluebyname(idx,'eventid',0);
   rset.addfieldvaluebyname(idx,'eventtype',30362);
   rset.addfieldvaluebyname(idx,'statusid',29801);
   rset.addfieldvaluebyname(idx,'objectid',"@eventid@");
   rset.addfieldvaluebyname(idx,'objecttype',8);
   rset.addfieldvaluebyname(idx,'eownerid',"@me.userid@");
   rset.addfieldvaluebyname(idx,"startdate","@year(currentdate)@-@month(currentdate)@-@day(currentdate)@");
   var rs=level23_update(false ,"",appid,3,rset);