Hello,
How do you get a recipient id immediately after it was inserted using xtk.session.write?
Example
xtk.session.Write(<recipient _operation="insert" lastName="Martinez" firstName="Peter" xtkschema="nms:recipient"/>);
//How to get the id of this newly added record?
Solved! Go to Solution.
Hi ,
If you want to use newly created row ID just after creating a record then I will suggest you to use second way to create records i.e usinf create method.
var object = namespace.schemaName.create( <schemaName col1 = {"value1"} col2 = {"value2"} /> );
object.save();
logInfo(" Id of latest added record is "+ object["id"]);
Thanks,
Kapil
Hi ,
If you want to use newly created row ID just after creating a record then I will suggest you to use second way to create records i.e usinf create method.
var object = namespace.schemaName.create( <schemaName col1 = {"value1"} col2 = {"value2"} /> );
object.save();
logInfo(" Id of latest added record is "+ object["id"]);
Thanks,
Kapil
Hi,
to complete kapscool's response, I don't think you get the rowid but THE (recipient) id with his method
var recipient= nms.recipient.create( <schemaName lastName= {"Martinez"} firstName= {"Peter"} /> );
recipient.save();
logInfo(" Id of latest recipient added is "+ recipient["id"]);
You can also use the NLWS create method (doc) :
var recipient= NLWS.nmsRecipient.create(
{recipient: {
lastName: "Martinez",
firstName: "Peter"
}});
recipient.save();
logInfo(" Id of latest recipient added is " + recipient.id);
Kind regards,
Pierre
Thank You!
Views
Likes
Replies
Views
Likes
Replies