cancel
Showing results for 
Search instead for 
Did you mean: 

How to add Alert message in SAP B1 using Service Layer ?

former_member209771
Active Participant
0 Kudos

Hi Expert ,

I had previously done alert message add in sap b1 using DI API. Now i want to add same using Service Layer. Please give me any reference .below is my di api code:

CompanyService oCompServ = oCompany.GetCompanyService();

MessagesService oMsgServ = (MessagesService)oCompServ.GetBusinessService(ServiceTypes.MessagesService); Message oMsg = (Message)oMsgServ.GetDataInterface (MessagesServiceDataInterfaces.msdiMessage);

oMsg.Subject = "New Web Order Placed";

oMsg.Text = "Order Details. With DocEntry:....;

RecipientCollection oRcptColl = oMsg.RecipientCollection; oRcptColl.Add(); oRcptColl.Item(0).SendInternal = SAPbobsCOM.BoYesNoEnum.tYES; oRcptColl.Item(0).UserCode = "manager"; SAPbobsCOM.MessageDataColumns oMsgDataCols = oMsg.MessageDataColumns; SAPbobsCOM.MessageDataColumn oMsgDataCol = oMsgDataCols.Add(); oMsgDataCol.ColumnName = "Order No"; SAPbobsCOM.MessageDataLines oLines = oMsgDataCol.MessageDataLines; SAPbobsCOM.MessageDataLine oLine = oLines.Add(); oLine.Object = "17"; oLine.ObjectKey = "DocEntry"; oLine.Value = sboOrderNo; oMsg.Priority = SAPbobsCOM.BoMsgPriorities.pr_High;

oMsgServ.SendMessage(oMsg);

Thanks

Surajit Kundu

Accepted Solutions (1)

Accepted Solutions (1)

former_member390407
Contributor

Hi Surojit,

You can find SL documentation at https://<ServerAddress>:50000

If you go to API reference you can find there the following:

POST https://localhost:50000/b1s/v1/Messages

{
    "MessageDataColumns": [
        {
            "ColumnName": "Document",
            "Link": "tYES",
            "MessageDataLines": [
                {
                    "Object": "17",
                    "ObjectKey": "2",
                    "Value": "1"
                }
            ]
        }
    ],
    "RecipientCollection": [
        {
            "SendInternal": "tYES",
            "UserCode": "andy"
        }
    ],
    "Subject": "service layer subject 01",
    "Text": "test by service layer"
}

Probably this is what you are looking for.

Answers (1)

Answers (1)

former_member209771
Active Participant
0 Kudos

Hi Sergei,

Thanks for your answer .