Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Web app to update a custom schema other than recipient schema

AbhijeetSrivastava
Level 2
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

10 Replies
Manoj_Kumar_
Community Advisor
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...

 

 

 

AbhijeetSrivastava
Level 2
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'.

Manoj_Kumar_
Community Advisor
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.

AbhijeetSrivastava
Level 2
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"/>)

 

Manoj_Kumar_
Community Advisor
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.

AbhijeetSrivastava
Level 2
Level 2

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

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

AbhijeetSrivastava
Level 2
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.

Manoj_Kumar_
Community Advisor
Community Advisor

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

AbhijeetSrivastava
Level 2
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.

Manoj_Kumar_
Community Advisor
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_Kumar_
Community Advisor
Community Advisor

Also, Your SalesforceId should exists in the schema

AbhijeetSrivastava
Level 2
Level 2

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

Manoj_Kumar_
Community Advisor
Community Advisor

Can you share the screenshot of debug mode to troubleshoot?

Sukrity_Wadhwa
Employee
Employee

Hi @AbhijeetSrivastava,

 

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

 

Thanks!