Expand my Community achievements bar.

Web app to update a custom schema other than recipient schema

Avatar

Level 2

Hello Everyone,

I want to build a simple web app that updates to a custom schema (offerActivation schema). When I am selecting the document type in the web as offerActivation schema and sending the link in an email and trying to open that link, it is not working. I guess this could be because in the browser there is context related to the recipient schema. I have tried out a lot of things, but it is not working for me. 

I am working with Adobe campaign classic.

Can anyone help me , how to just create a simple web app to update a schema other than the recipeint schema.?

 

Thank you,

Abhijeet

14 Replies

Avatar

Community Advisor

Hello @AbhijeetSrivastava 

 

You can update the custom schema by using Data oriented APIs.

 

Here is a sample code on how to update a customer schema.

xtk.session.write(<customSchemaName _operation="insert" columnName="value" xtkschema="namespace:customSchemaName"/>)

More details are available here: https://experienceleague.adobe.com/docs/campaign-classic/using/configuring-campaign-classic/api/data...

 

 

 


     Manoj
     Find me on LinkedIn

Avatar

Level 2

Hi Manoj,

I have kept nms:recipient as the document type in the web app and I have a js activity with the below code.

xtk.session.Write(<offerActivation _operation="update" _key="@salesforceId" offerStatus="as" xtkschema="bp:offerActivation"/>)

 

I am getting the below error:

 

QUE-370007 Unable to find key values for element 'Offer Activation ' (document with schema 'offerActivation') XSV-350023 Unable to save document of type 'Offer Activation (bp:offerActivation)'. SOP-330011 Error while executing the method 'Write' of service 'xtk:persist|xtk:session'.

Avatar

Community Advisor

@AbhijeetSrivastava  As mentioned in the error message. You are missing the primary key (salesforceID) against which the data should be updated.

 

Your code should be something like this.

xtk.session.Write(<offerActivation _operation="update" _key="@salesforceId"  salesforceId={SALES_FORCE_ID} offerStatus="as" xtkschema="bp:offerActivation"/>

Let me know if that works.


     Manoj
     Find me on LinkedIn

Avatar

Level 2

@_Manoj_Kumar_ This works in the preview mode of the web app. But when I send this link in an email and then try to open it, it gives the below error.

An error occured

In this persists contact adobe admin.

JS code:


xtk.session.Write(<offerActivation _operation="update" _key="@salesforceId" salesforceId={"125jdkd"} offerStatus="df" xtkschema="bp:offerActivation"/>)

 

Avatar

Community Advisor

In the preview mode, Are you selecing the recipient manually? If yes, Then you need to pass the encrypted recipient id parameter in the URL.

 

Also, You can make use of debug mode to trouble shoot issue and get more details on the error.


     Manoj
     Find me on LinkedIn

Avatar

Level 2

@_Manoj_Kumar_  Below is my url. I am passing the recipient id.

/webApp/APP7?id=<%=escapeUrl(cryptString(recipient.id))%>

Avatar

Level 2

If I remove my js code to update the offerActivation table and try to update something in the recipient table, then it works. It is not working for other tables and I don't understand why.

Avatar

Community Advisor

Can you share your JS Code? Without that it won;t be possible to identify the issue.


     Manoj
     Find me on LinkedIn

Avatar

Level 2

below is my js code:

xtk.session.Write(<offerActivation _operation="update" _key="@salesforceId" salesforceId={"123xyz"} offerStatus="df" xtkschema="bp:offerActivation"/>)

 

I am hardcoding the salesforce id for now.

Avatar

Community Advisor

changed the code to this.

 

var salesForceId="123xyz";

xtk.session.Write(<offerActivation _operation="update" _key="@salesforceId" salesforceId={salesForceId} offerStatus="df" xtkschema="bp:offerActivation"/>)

     Manoj
     Find me on LinkedIn

Avatar

Community Advisor

Also, Your SalesforceId should exists in the schema


     Manoj
     Find me on LinkedIn

@_Manoj_Kumar_ Still it is behaving the same. Working in the preview mode and not working in the browser.

Avatar

Community Advisor

Can you share the screenshot of debug mode to troubleshoot?


     Manoj
     Find me on LinkedIn

Avatar

Administrator

Hi @AbhijeetSrivastava,

 

Were you able to resolve this query or do you still need more help here? Do let us know.

 

Thanks!



Sukrity Wadhwa