Hello everyone,
we are using person delete webhook for synchonizing the person to ERP in our new project.
According the documentation are Values available in this webhook:
In our test (delete company with a person), after waiting for deleting a person from recycle bin, we got this:
What could be a reason for missing the parameters here?
Thank you in advance!
Best regards,
Andrey
Alle Svar (6)
Hi Andrey!
Because CRMScript webhook handlers are "in-app", the includes JSON properties are not the same as the external webhook type. There are more interesting properties.
The docs state these as the available parameters:
One way you can see what's really available is to use tracing, or relay the contents to an external site, like webhook.site.
#setLanguageLevel 3;
Map m = getVariables();
String s = m.toJson();
print(s); // for tracing purposes.
// or
HTTP x;
x.addHeader("Content-Type", "application/json");
x.setOption("parameters", "?" + s);
String response = String(x.post("https://webhook.site/410e4335-0821-499d-b131-4f6159233fc0"));
printLine(response);
Either will work just fine. What you will see if that the parameters you are interested in appear as Changes.[fieldname].
So in that case this should do the trick.
getVariable("Changes.person_id");
getVariable("Changes.updated_associate_id");
getVariable("ChangedByAssociateId");
getVariable("activeUser");
getVariable("activeUsername");
Hope this helps!
Hello Tony,
many thanks for the quick response.
I tested both person.softdelete and person.delete CRMScript webhooks, both have no parameter for contact_id. That is very sad.
Is there a method to read a softdeleted person in CRMScript? That could be an alternative. I tried it with SearchEngine, and it don't works.
Thank you!
Best greagards,
Andrey
Hi Andrey,
The way to get a soft-deleted company or contact is to submit a query using the RecycleContact and RecyclePerson archive provider.
Example:
GET https://{{env}}.superoffice.com/{{tenant}}/api/v1/archive/recycleperson/?$select=firstName,lastname,personContact/orgnr&$filter=personId eq 61106
Accept: application/json
Authorization: Bearer {{token}}
Hope this helps!
Hello Tony,
thank you, it helped.
For anyone who wants to know the contact Id of the soft-deleted person, here is my source:
Best regards,
Andrey