CRMScript Webhook online: missing values

lock
push_pin
done
Answered
6

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

 

15 Sep 2023 | 12:08 PM

All Replies (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!

 

 

 

15 Sep 2023 | 03:48 PM

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

19 Sep 2023 | 07:05 AM

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!

19 Sep 2023 | 07:34 AM

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

19 Sep 2023 | 03:15 PM
Hi,

You can use the global function decodeDBValue to decode the encoded integer, saves you the subtitute steps :)
19 Sep 2023 | 03:20 PM

Thank you, now it is perfect! :)

19 Sep 2023 | 03:53 PM

Add reply