cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creating a Dynamic Formatted Search Query for Send Message in SAP Business One

jun_dolor
Participant
0 Kudos
493

I need to create a Formatted Search query for the Subject and Message fields in the Send Message functionality. The query should dynamically retrieve information based on the context in which Send Message is used.

For Example

  • If I execute Send Message from a Goods Receipt PO, the query should fetch the Vendor from the corresponding Goods Receipt PO.
  • If I execute Send Message from a Goods Return, the query should fetch the Vendor from the related Goods Return document.

The query should look more or less like the one below. How do I construct the $[$] syntax to identify the document columns where the Send Message is running?

--$X is the document where the Send Message is displayed
If $[$X.ObjType = 20] --Goods Receipt PO
    BEGIN
        SELECT CardCode from OPDN WHERE DocNum = $[$X.DocNum]
    END
ELSE IF $[$X.ObjType = 21] --Goods Return
    BEGIN
        SELECT CardCode from ORPD WHERE DocNum = $[$X.DocNum]
    END

 

 

View Entire Topic
jun_dolor
Participant
0 Kudos

The code for the Send Message FMS is something like this:

IF $[$10.V_1] = 20 --Goods Receipt PO
  BEGIN
    SELECT CardCode from OPDN WHERE DocNum = $[$10.V_0]
  END
ELSE IF $[$10.V_1] = 21 --Goods Return
  BEGIN
    SELECT CardCode from ORPD WHERE DocNum = $[$10.V_0]
  END