Hello suite developers, I am trying to realize a ...
# suitescript
z
Hello suite developers, I am trying to realize a simple workflow : I have a button on the Form of a custom record, and workflow action creates a bill. Everything works fine for creating bills. Bills are created and I put ID’s in the sublist (I don’t have on parent record field where “created bill” can be stored…
Copy code
const newBillID = newBill.save();

const sublistID = 'recmachcustrecord_levi9_rent_sublist_id';
newRecord.selectNewLine({sublistId: sublistID}); // Select a new line on the custom sublist
newRecord.setCurrentSublistValue({sublistId: sublistID, fieldId: 'custrecord_levi9_rent_sublist_bill', value: newBillID});
newRecord.commitLine({sublistId: sublistID}); // Commit the new line

return newBillID;


That's why I am trying to return newBill internal ID from workflow action. The client would like to be redirected (Go to Record action) to the new created Bill.
I store the result from workflow action script into workflow field (screenshot) The next step is Go To Record and ID should be value from workflow field (screenshot) (edited) But, NetSuite open form with Create New BILL … Any idea how to realize • workflow action creates a transaction • id is returned from workflow action script • NetSuite go to record (existing new bill)
b
very likely that you should be asking in #C2C2JM29M, it looks like you are specifying which joined record to get the id from
without the actual field to get the id to go to
c
I don't think you can edit the lines of "recmach" sublists... I think those lines are custom records (custrecord_levi9_rent_sublist_id) you would have to create a new instance of that custom record and there would be a field that joins to the transaction you are working with.
z
@Chris Mercer FYI, it is working. I hope there is someone from NetSuite engine team to explain how it works 🙂, honestly, I was prepared to do it on your way, but wish to know WHAT IF I CREATE a sublist line. Just for a test. The thing is more strange when I add it is workflow action after transition “EXECUTE BUTTON” from Before Load State, View event. Record is not going into EDIT mode (parent record), but workflow action creates a new sublist line and saves it. BUT, I don’t have issue with workflow action script. I am asking how to: • return id of new created Vendor Bill from workflow action • store it in WORKFLOW FIELD • Go to Record (open the created bill) where internal ID is value stored in workflow field Is it possible that NetSuite doesn’t update the value for the workflow field until all actions are executed? That can cause “null” value for Go To Record action, and open Create new Bill form… I thought that there is something to add in WorkFlow action, now going to put focus on WorkFlow execution
b
returning the id of the newly created vendor bill is not hard, you make your script return a value
if you think you wrote the script wrong, just hardcode the value it returns
storing the returned value in a workflow field is also easy, you already shared that you set the workflow field for that
you should be able to confirm that the field is being correctly set by taking a look at the workflow history of whatever record you are working wtih
and for the go to record, as far as i can tell, you just dont know how it works, so my recommendation is to learn how to redirect to any record
it would probably be easier if you started with redirecting to a record actually specified on a real field on your custom record
or if you want to make your current configuration work, then a field on the bill you created
z
Hi @battk from the Workflow logging I see that workflow field (name New Bill ID has been set
Thank you @battk for suggestions. Finally, I found out how “Go To Record” works and how to use the workflow field as an ID parameter. What was wrong? The workflow field MUST BE List/Record type and Transaction subtype! Here is the configuration • return type for workflow action = List/Record Transaction • New Bill ID workflow field type = List/Record Transaction • Go To Record ID Field = New Bill ID (Workflow) and everything works!
Once again, thank you @battk for you you master degree help