BPM Newbie: BPM to show a message based on a field value (IF statement)

Hi All,

Sorry I’m completely new to BPM custom code, which is what I think I’ll need to use here to achieve the results or maybe not?

I was wondering if anyone knows if this is possible please?

I’m trying to get a warning message to pop-up within receipt entry, that looks at what info is stored in POHeader.POType_c and presents it within the message.

I’ve got as far as creating a a Post-Process method on Erp.BO.Receipt.GetPOInfo and then created a variable for the message to get stored.

Now I’m looking to set code that looks at PO Header table, the POHeader.POType_c field specifically, i.e. if POType_c says ‘No further action required’ then show in the receipt warning message ‘No further action required’.

Thank you for any help and tips as always!

I think you should just be able to do this

A condition that says if POType_c is equal to the expression “No further action required” = True → Show Message “No further Action”

Thank you Chris for the suggestion!! :smiley:

I’ve just tried to pull up the condition but the POType_c field exists in POHeader, and only the Receipt tables are available.

I’m looking to the create the condition on the Receipt.GetPOInfo method so it’s possibly why I’m not seeing the PO tables?

Thanks

Not to derail this thread at all, but how did you get BPM Designer in dark mode? Is that the browser version?

3 Likes

There is an option in the condition widget for Specified expression is valid. You should be able to use that with something like the code below to check the field on POHeader. That code was generated from ChatGPT and I haven’t tested it but it should be close.

Db.POHeader.Where(po => po.Company == CallContext.Current.Company 
                     && po.PONum == ttDataset.PONum)
           .Any(po => po.POType_c == "No further action required")

I have had success in the past using the Condition, ‘Number of rows in the designed query is more or equal to 1’ (Modify as needed) to access Table fields not available from those displayed using the ‘specified field’ option in other conditions.

This should get you started:

var r = ds.RcvHead.FirstOrDefault(x => x.RowMod == "U" || x.RowMod == "A");

if (r != null)
{
    var po = (from POHeader_Row in Db.POHeader
              where POHeader_Row.Company == CallContext.CurrentCompany
              && POHeader_Row.PONum == r.PONum
              && (POHeader_Row.POType_c != null || POHeader_Row.POType_c != "")
              select POHeader_Row).FirstOrDefault();

    if (po != null)
    {
        this.PublishInfoMessage($"{po.POType_c}", 
            Ice.Common.BusinessObjectMessageType.Information, 
            Ice.Bpm.InfoMessageDisplayMode.Grid, 
            "ReceiptEntry", 
            "GetPOInfo-PreProcessing-TEST");
    }
}

3 Likes

Some cool Chrome/Edge add ins!

https://darkreader.org - For the “dark mode”

Another good one is https://stylebot.dev

Style bot allows you to change certain items in the css per website.

Best example I have its the side bar colors

  • For our dev environment its Orange

    image

  • For Production its Green

    image

2 Likes

@itsme has the solution!

My apologies, I totally forgot the POHead is not in the datasets for the Erp.BO.Receipt

Season 3 Wall GIF by The Simpsons

2 Likes

Honestly thank you so much for this!! This did exactly what we were looking for without having to hardcode IF and condition statements.

Think maybe it’s the version of Kinetic but just had to switch out the company line to
where POHeader_Row.Company == callContextClient.CurrentCompany
and it worked.

Thanks again! :smiley:

1 Like

Really appreciate the help though!! Thanks Chris! :smiley:

This is correct! I made a typo in my code, but I’ve now edited it—thanks to you!

1 Like