Hi Team,
I have created WebApp with Input Form with FirstName, LastName, Email in 1st page. And some Check box inputs in 2nd page.
my WebApp workflow configured like below.
1st page Input Values should Update into Recipient schema. But its not working with below script.
// Update RCP Data
var id = ctx.recipient.@id;
var ID_PARTENAIRE = ctx.vars.bp_id;
var Business = ctx.vars.bp_Business;
var Entity = ctx.vars.bp_Entity;
var currentDate = formatDate(new Date(), "%4Y/%2M/%2D %02H:%02N:%02S");
xtk.session.Write(<recipient xtkschema="nms:recipient" operation="_update" _key="@id,@ID_PARTENAIRE,@Business,@Entity" firstName={ctx.vars.updfirstName} lastName={ctx.vars.updlastName} email={ctx.vars.updemail} lastModified={currentDate} />);
Getting below Error once submit the Button in Form, stating Unable to find the Key values for element Recipient.
Note: we have Extended the nms: recipient schema and added custom columns as Keys. I am using those for Update or Insert Operations.
Other hand, same script inserting new record when I am trying without Key argument.
The Storage activity not helping to update, pre-loaded columns.
Can anyone help me solve this error.
Thank you.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello @SantoshKa5
When performing an update operation using xtk.session.Write
, you should specify the attributes that correspond to the keys in the XML structure. This ensures that the update operation correctly identifies the recipient record you want to modify.
Here’s how you can modify your xtk.session.Write
call to include the attributes explicitly:
// Update RCP Data
var id = ctx.recipient.@id;
var ID_PARTENAIRE = ctx.vars.bp_id;
var Business = ctx.vars.bp_Business;
var Entity = ctx.vars.bp_Entity;
var currentDate = formatDate(new Date(), "%4Y/%2M/%2D %02H:%02N:%02S");
xtk.session.Write(
<recipient xtkschema="nms:recipient" operation="_update"
_key="@id,@ID_PARTENAIRE,@Business,@Entity"
id={id}
ID_PARTENAIRE={ID_PARTENAIRE}
Business={Business}
Entity={Entity}
firstName={ctx.vars.updfirstName}
lastName={ctx.vars.updlastName}
email={ctx.vars.updemail}
lastModified={currentDate} />
);
Br,
Views
Replies
Total Likes
// Update RCP Data
var id = ctx.recipient.@id;
var ID_PARTENAIRE = ctx.vars.bp_id;
var Business = ctx.vars.bp_Business;
var Entity = ctx.vars.bp_Entity;
var currentDate = formatDate(new Date(), "%4Y/%2M/%2D %02H:%02N:%02S");
xtk.session.Write(<recipient xtkschema="nms:recipient" _operation="insertOrUpdate" _key="@id,@ID_PARTENAIRE,@Business,@Entity" firstName={ctx.vars.updfirstName} lastName={ctx.vars.updlastName} email={ctx.vars.updemail} lastModified={currentDate} />);
Views
Replies
Total Likes
Hi @SantoshKa5
Can you please check whether the ctx.vars.updfirstName and other ctx variable have the value .
Eg:logInfo("Value of updfirstName: " + ctx.vars.updfirstName);
And Pass them like below
var firstname = ctx.vars.updfirstName;
And in the xtk.write method,
Change into firstName={fristname} do the same for lastname and email
Views
Replies
Total Likes
Hi @SantoshKa5 ,
Please try this below code and let me know whether its works
var xml = '<recipient xtkschema="nms:recipient" _operation="Update" _key="@id,@ID_PARTENAIRE,@Business,@Entity" ' +
'firstName="' + ctx.vars.updfirstName + '" ' +
'lastName="' + ctx.vars.updlastName + '" ' +
'email="' + ctx.vars.updemail + '" ' +
'lastModified="' + currentDate + '"' +
'/>';
xtk.session.Write(xml);
Views
Replies
Total Likes
Hello @SantoshKa5
When performing an update operation using xtk.session.Write
, you should specify the attributes that correspond to the keys in the XML structure. This ensures that the update operation correctly identifies the recipient record you want to modify.
Here’s how you can modify your xtk.session.Write
call to include the attributes explicitly:
// Update RCP Data
var id = ctx.recipient.@id;
var ID_PARTENAIRE = ctx.vars.bp_id;
var Business = ctx.vars.bp_Business;
var Entity = ctx.vars.bp_Entity;
var currentDate = formatDate(new Date(), "%4Y/%2M/%2D %02H:%02N:%02S");
xtk.session.Write(
<recipient xtkschema="nms:recipient" operation="_update"
_key="@id,@ID_PARTENAIRE,@Business,@Entity"
id={id}
ID_PARTENAIRE={ID_PARTENAIRE}
Business={Business}
Entity={Entity}
firstName={ctx.vars.updfirstName}
lastName={ctx.vars.updlastName}
email={ctx.vars.updemail}
lastModified={currentDate} />
);
Br,
Views
Replies
Total Likes
Hi @Amine_Abedour ,
Thanks Amine. Its worked for me. I forgot to include those Keys.
Views
Likes
Replies