Skip to Content
avatar image
Former Member

SAP C4C Send Email by Custom Button

Hello ,

In 1705,I had met a question : I use SDK example code(as picture show) to send a email in an action.absl(as picture show)

I have done some business configuration and master data but when I clicked the button to send email I didn't receive the email at the same time I didn't received error messages.

Did I leave out any configuration,I have maintained employees' mail address?

(In addition, I debugged my action.absl and the codes can run completed)

So,I don't know what is wrong with my operation ,can anyone give me some advices?

Thanks in advance very much!!

sendemail.png (155.2 kB)
sendmail.png (36.7 kB)
sendmaile2.png (67.6 kB)
sendmail3.png (24.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 23, 2017 at 12:07 PM

    Hi,

    I think problem might be, that your all mail is delivered into 653237091@qq.com mailbox. Does this mail exist at all?

    br,

    Zoran

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 26, 2017 at 11:10 AM

    Ok, the second problem is that "MessageFromParty" HAS TO BE valid employee from your system (please check if

    121503253@qq.com is associated to valid employee in your system, btw. "MessageFromParty" will be populated automatically from your session, see bellow in the code snippet)

    Hint 1: don't forget to press save button on your business object where you execute this part of code.

    Hint 2: don't forget to provide user access rights to Activities work center for user that is sending this mail

    Result: email has to arrive on valid mailbox, and activity entry type email has to be visible on Activities work center.

    import ABSL;
    import AP.PC.ActivityManagement.Global; 
    var elActivityRoot					:elementsofActivity;
    var instActivity;
    var elActivityParty					:elementsofActivity.Party;
    // Activity: define text collection
    var elActivityTxtCollTxt:      elementsofActivity.TextCollection.Text;
    var elActivityTxtCollTxtCntnt: elementsofActivity.TextCollection.Text.TextContent;
    var instActivityTxtColl;
    var instActivityTxtCollTxt;
    elActivityRoot.TypeCode="39";
    elActivityRoot.SubjectName="Test from ABSL code 0001";
    instActivity = Activity.Create(elActivityRoot);
    //MessageFromParty will be automatically set from your session but if from some reason is not set then you have to set/change it by yourself with REAL employee name from your system
    if (! instActivity.MessageFromParty.IsSet()) {
    //real employee from your system defined by ID, Name or Email:
    elActivityParty.PartyName = "FirstName LastName"; 
    instActivity.MessageFromParty.Create(elActivityParty);
    	}
    //MessageFromParty will be automatically set from your session but if from some reason is not set then you have to set/change it by yourself with REAL employee name from your system
    if (! instActivity.EmployeeResponsibleParty.IsSet()) {
    //real employee from your system defined by ID, Name or Email:
    elActivityParty.PartyName = "FirstName LastName"; 
    instActivity.EmployeeResponsibleParty.Create(elActivityParty);
    	}
    //message sent to
    elActivityParty.PartyName = "XXXXXXX@gmail.com";
    instActivity.MessageToParty.Create(elActivityParty);
    //Assotiation to Contact
    elActivityParty.PartyName = "CONTACT NAME FROM CONTACT BO.";
    instActivity.ContactParty.Create(elActivityParty);
    //Assotiation to Account
    elActivityParty.PartyName = "ACCOUNT NAME FROM ACCOUNT BO";
    instActivity.ActivityParty.Create (elActivityParty);
    // Create a text of type "Body Text"
    instActivityTxtColl = instActivity.TextCollection.Create();
    elActivityTxtCollTxt.TypeCode.content = "10002";
    instActivityTxtCollTxt = instActivityTxtColl.Text.Create(elActivityTxtCollTxt);
    elActivityTxtCollTxtCntnt.Text.content = "Body text of the Activity Email";
    instActivityTxtCollTxt.TextContent.Create(elActivityTxtCollTxtCntnt);
    //send message
    instActivity.Send();
    

    Please use following code snippet and mark this answer correct if you accept this :-)

    Add comment
    10|10000 characters needed characters exceeded