I have 2 custom records A ,B when user makes a new...
# general
r
I have 2 custom records A ,B when user makes a new record in A and submits it. so with userevent script I want to create a new record in B and fill the fields. I have got the values from A via getValue api. and I know about the setValue api My query is how to create a new record in B and get that in context object.
s
basically your script will be deployed in A when you create the UE script deployed in a, you can use the N/record module in record.create you can specify to create in record type of B, and use set value on this record object, then you can save this record object, which will return the record id of the record you created in record type of B
r
How can I specify to create in record type of B ?
s
in the record.create({type:'customrecord_mycustomrecordidforB'})
r
Thank you
keanu thanks 1
record.create({ type:'customrecord801', defaultValues: { "custrecord0006": employee, "custrecord0007": salaryCost } }); record B's id is customrecord801. It has 2 fields in it with id: custrecord0006, custrecord0007 employee and salaryCost are variables. What am I doing wrong here?
b
thats not how N/record Default Values work
and the Record Object Members to see what options you have
r
Thank you so much, I was unable to figure out for so long. It worked now.