Got someone working on a record.transform. It's to...
# suitescript
k
Got someone working on a record.transform. It's to transform from a custom record to create a customer and then create a SO from the details on the custom record. What would the best way to do this from a button on the custom record form?
r
Could be possible using a formless suitelet. Click on the button calls the suitelet. Suitelet creates the record then redirects
k
Would want it to do the transform but then the SO would need to be in edit mode and displayed to the user to carry on and do something with it.
Doesnt need to be saved to the Database then.
not sure is record.transform does that as never used it before.
r
N/redirect allows you to go to the record in edit mode, but I think it has to be an existing record
k
If i click on new SO in the UI it will transform to a new SO transaction in creation mode.
that is where i want it to get to.
So the record.transform would be done based on having a customer id to do it against.
click button that then creates customer and then use record .transform to redirect to the new SO creation.
Sounds doable just not sure about the script process.
Sorry @rustyshackles I'm rambling lol
It's 10pm here and i should be going to bed.
r
You can redirect to the New Sales Order page, but it wont be prepopulated. The method is redirect.toTaskLink
Not sure if you can pre-populate fields by adding them in the URL
k
Hmmmmm might have to go down the road of a suitelet and save the transaction as need it to have an item already on there. Maybe then redirect to the Sales order with it being in edit mode stright away. Only issue then i need to set mandatory field values on creation.
b
you can redirect to the new sales order page
and use parameters to set default values like the entity
r
I saw this in the redirect module help: redirect.toRecordTransform. Haven't tried it so not sure how it works
b
i dont think customer to sales order is an actual transform
r
According to the help under Supported Transformation Types. Customer to Sales Order is valid.
b
weird
might work then
k
Yeah just not sure if I can add items. If I do the transform I think I’d have to pass a param and then add the item once the page has loaded or something
Using the client script maybe on page init
Think SL sounds like an easier road and just create the records and redirect to edit mode.
Hopefully using ignoreMandatory on record creation
Thanks for your help guys!! Will work on this more tomorrow I think.