I am quite sure that this is somehow a basic/stupid question but I just don’t find the answer.
How do I insert a new record to an entity using Javascript (which is called on an onChange event)?
My aim is to insert 4 values read from an incident-form to a custom entity called statuslog.
It’s easy enough to read the four fields.
// Statuscode: "1st Level Support"
var statuscodeTextValue = getPicklistValueText("statuscode");
// Incidentid: "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEEE"
var incidentid = getGUIDOfCurrentRecord();
// Ownerid: "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEEF"
var ownerid = getGUID("ownerid");
//timestamp is "Fri Oct 12 16:50:34 UTC +0200 2012"
var timestamp = new Date();
But what do I have to do next? A specific code example would be very much appreciated. 🙂
By far the best example I have seen of this is on Gareth Tucker’s excellent blog. In this post he creates a new Contact based on fields filled in on a phone call record. All code supplied, so you should be able to adapt to your custom entity and fields instead.
http://garethtuckercrm.com/2011/08/23/quick-create-contact-from-the-phone-call-form/