Popup message on sales order when certain item added

I am want to create a popup message/alert when certain items are added to a sales order.

This can be immediately after the item is added or upon saving the record. I have tried via workflow but it does not seem that Show Message action is available for line items?

Beginner Asked on September 17, 2020 in How To's.
Add Comment
3 Answer(s)

Hi Margie,

Agreed, you can’t trigger this directly from a sublist field.

However (and a lot depends on exactly what you’re trying to do), you might be able to get something to work if you set another field based on a change the to field you’re really interested in.

I’d probably start with trying Workflow Custom Field but a header field is another option.

I hope that makes sense and I’m very happy to answer any further questions.

Thanks,

Chris

Intermediate Answered on September 17, 2020.

Sorry I don’t quite understand what you are saying. So we have the situation where we have Product A that our customer order and about 97% of the time Product B is required with Product A is ordered. Our clients do not put Product B on their purchase order so I want to create an alert to remind the person entering the sales order to add Product B.

on September 17, 2020.

Hi Margie,

So I’m saying that if Product A is selected then you update a Workflow Custom Field.

When the record is saved, you check that field and you’ll know whether Product A has been ordered.

You can then say something like “Have you remembered to order Product B”?

I think it might just be difficult to reliably block the message if they have put Product B on already.

I hope that makes more sense.

Thanks,

Chris

on September 17, 2020.
Add Comment

Are there many “product As” or is it a case or two? Have you tried using item groups? Or a promotion that adds it automatically?
Also I can think of a client script or try the “items on order” field under the conditions for a workflow.
Happy to help out if you send over more details.

Beginner Answered on September 17, 2020.

I was thinking something like the “items on order” criteria too, but I just looked and I don’t see any such field in the workflow criteria. I’ve used “item on any line” in a saved search before but don’t see that in there either.

on September 18, 2020.

There is about 30 SKU’s that this applies to. Item groups or promotion is not really applicable as it is not applicable in 100% of the time so I was just wanting a message to remind the user to check if applicable or not. I can’d see the items on order condition for workflow. Can you help as to how to achieve this via client script.

on October 18, 2020.

Margie, sorry I saw this message just now. Through client script I can think of something like this:

/**

* @NApiVersion 2.x

* @NScriptType ClientScript

*

* @author Mercedes Lerena

* www.brokenrubik.co

*/
define(

[

'N/dialog'

],

function process(

_dialog

) {
function validateLine(context) {
var soRecord = context.currentRecord;

var list = context.sublistId === 'items';

var itemsArray = [123, 124, 125];

var currentItem;
if (list) {
currentItem = soRecord.getCurrentSublistValue({

sublistId: 'items',

fieldId: 'item'

});
if (itemsArray.indexOf(currentItem) !== -1) {

_dialog.alert({

title: 'Question?',

message: 'Please confirm this and that.'

}).then(success).catch(failure);

}

}

}
function success() {

// Something to do if pressed OK

}
function failure() {

// Something to do if function success had errors

}
return {

validateLine: validateLine

};

});

I did not try this before sending, if you need extra help, don’t hesitate in contacting me directly.

on November 2, 2020.

Hi,

 

I have tried your script but I am getting the following when I try to upload it:

Fail to evaluate script: {“type”:”error.SuiteScriptModuleLoaderError”,”name”:”UNEXPECTED_ERROR”,”message”:”missing ] after element list (SS_SCRIPT_FOR_METADATA#17)”,”stack”:[]}

 

I have not added any code for the success and failure functions. I just want the popup to work as a reminder.

Do you think you can help me out?

 

on July 18, 2022.
Add Comment

Hi Margie,

What you’re trying to do can’t be done unless scripted.

The trouble is that you can’t set WF items based upon item line criteria. If you then try to use a saved search as criteria to look for certain attributes in the line detail, the search won’t work until after the record is saved, and so the pop-up still won’t come up during the save process. At best you can get it to come up when someone opens the record to edit it. This means that whoever is creating the record won’t actually see the pop-up at all when they create and save it. To work around this we have created saved searches that send automatic emails when certain criteria are met. This is obviously not ideal, but if you talk to a developer they would be able to script out what you’re looking for.

Beginner Answered on October 30, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor