Hello all,
I've got a workflow that triggers when a queue item is created, creating a new Case record.
The workflow is unable to directly set the "Customer" field in the Case to the "From" field of the original email because of the different in field type.
As an attempted workaround without having to create a custom workflow activity, I've created a new text field in the Case entity called "new_emailfrom".
The workflow logs the email "From" field into this new field in the Case entity, so it will contain an email address)
Is it possible to use javascript upon form save to:
1.Take the value of "new_emailfrom" field
2.Search for a contact that has this email address
3.Sets the "customerid" field in the Case to be the found contact.
I've drafted up some code but I don't know how to approach step 2, or if it's even possible.
Any help gratefully received,
Jscript so far:
function retrievecontactBycontactemail()
{
var contactemail = Xrm.Page.getAttribute("new_emailfrom").getValue();
if (contactemail != null)
{
//find a contact where "emailaddress1" field = contactemail
}
Xrm.Page.getAttribute("customerid").setValue(foundcontact);
}
Thanks,
James