Skip to Content

Errors While creating an Email Activity?

Hi Experts,

I am creating an Email Activity with the type code "39" in the Before Save script file of Activity while saving the Activity Task(TypeCode: 542).

But i am getting the following errors with the standard code which sap has given in the repository explorer for Email Activity Creation..!!

these are the errors:

Please enter a process type.

Save failed. Technical error due to object ID not determined. Please report an incident.

Identity is invalid or could not be determined. Please check.

Date is invalid or could not be determined. Please check.

Save failed..

Why is that i am getting these errors?? i used the code which is there in the 1402 repository explorer..

Thanks,

Mani

Task.PNG (11.4 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 26, 2014 at 12:59 PM

    Hi Mani,

    the problem was solved with the following workaround! Is working fine 😊

    Please check:

    How to generate an email instance inside the new 1402 Activity BO - Workaround


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Allesandro,

      Great Work..!!

      I raised an incident to SAP, I am waiting for the response , If they can't fix this then i will implement the workaround.

      I have everything ready to implement your work around.

      Thank you for the work around.😊

      Thanks,

      Mani

  • avatar image
    Former Member
    Feb 22, 2014 at 11:35 PM

    In 1402 Cloud for Customer we re-architected the activity BO backend to make it more lean and simple. You will notice there are 2 "activity" BOs in the repository explorer, one that has been "deprecated" and the other "active". I have a working sample using the sample provided in the repository explorer to create activity tasks via a custom action. What I noticed is that if you don't reference the right "activity" you will inadvertently write code that will reference the deprecated activity. Your code will activate, but will not work. Once I referenced the right "activity" and then corrected the code (the new activity BO structure is different so the type-ahead code completion results are different) everything worked correctly.

    As an FYI, pre 1402 ABSL code and UI designer configuration for any activity related SDK work (emails, tasks, appointments, phone calls) will need to go through this refactoring to use the new activity BO. The old activity BO is deprecated and custom business logic/custom UI referencing this old activity BO will not work anymore in 1402.

    Here is my sample

    /*

    Add your scripting language implementation for:

    Business Object: ServiceContract

    Node: Root

    Action: CreateActivityTask

    Note:

    - To access the elements of the business object node,

    use path expressions, for example, this.<element name>.

    - To use code completion, press CTRL+J.

    */

    import ABSL;

    import AP.PC.ActivityManagement.Global;

    //Activity: Root node

    var elActivityRoot : elementsof Activity;

    var instActivity;

    // Activity: define party node

    var elActivityParty : elementsof Activity.Party;

    var instParty;

    // Activity: define text collection

    var elActivityTxtCollTxt: elementsof Activity.TextCollection.Text;

    var elActivityTxtCollTxtCntnt: elementsof Activity.TextCollection.Text.TextContent;

    var instActivityTxtColl;

    var instActivityTxtCollTxt;

    // Activity: define attachment folder

    var elActivityAttachmDoc: elementsof Activity.AttachmentFolder.Document;

    var instActivityAttachm;

    // Activity: maintain Business Object type - mandatory (12 = Appointment; 39 = Email; 86 = Phonecall; 542 = Task)

    elActivityRoot.TypeCode = "542"; // create Task

    // Activity: maintain description - mandatory

    elActivityRoot.SubjectName = "Task created for Contract";

    elActivityRoot.ServiceContractIDForActivity = this.ServiceContractID;

    // Activity: create new instance

    instActivity = Activity.Create(elActivityRoot);

    /*

    // Activity: Organizer party - mandatory

    if (! instActivity.OrganizerParty.IsSet()) {

    // supply party either with ID: MC2471 or Name: Kate Jacob or Email: Kate.Jacob@silverstar.us, etc.

    elActivityParty.PartyName = "MC2471";

    instActivity.OrganizerParty.Create(elActivityParty);

    }

    // Activity: Attendee party - optional

    elActivityParty.PartyName = "MCPC9785";

    instActivity.AttendeeParty.Create(elActivityParty);

    */

    // Activity: Set Employee Responsible (optional, because party determination applies rules for automatic determination)

    if (! instActivity.EmployeeResponsibleParty.IsSet()) {

    elActivityParty.PartyName = this.EmployeeResponsibleID;

    instActivity.EmployeeResponsibleParty.Create(elActivityParty);

    }

    if (! instActivity.MainActivityParty.IsSet()) {

    elActivityParty.PartyName = this.CustomerID;

    instActivity.MainActivityParty.Create(elActivityParty);

    }

    if (! instActivity.MainContactParty.IsSet()) {

    elActivityParty.PartyName = this.ContactID;

    instActivity.MainContactParty.Create(elActivityParty);

    }

    // Activity: set start and end time

    instActivity.ScheduledStartDateTime.content = GlobalDateTime.ParseFromString("2014-01-14T13:30:00Z");

    instActivity.ScheduledEndDateTime.content = this.EndDate.ConvertToGlobalDateTime();

    //GlobalDateTime.ParseFromString("2014-01-14T15:00:00Z");

    // 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 Appointment";

    instActivityTxtCollTxt.TextContent.Create(elActivityTxtCollTxtCntnt);

    // Create an attachment of type "Link"

    instActivityAttachm = instActivity.AttachmentFolder.Create();

    elActivityAttachmDoc.Description.content = "PDI Comment for Attachment";

    elActivityAttachmDoc.CategoryCode = "3";

    elActivityAttachmDoc.Name = "SAP";

    elActivityAttachmDoc.AlternativeName = "SAP Homepage";

    elActivityAttachmDoc.ExternalLinkWebURI = "http://www.sap.com";

    instActivityAttachm.Document.Create(elActivityAttachmDoc);

    Add comment
    10|10000 characters needed characters exceeded

    • I tried the following workaround without success:

      1) Create the email instance in a different save process than the one where the activity modifications are saved

      2) Create the email instance in a mass data run (you have to retrieve the main activity, create the email and then save both, so it's not working. Also the minimum schedule time is 1 hr)

      The problem exists when you try to save the activity and the email (also an activity) in the same dialog step/database transaction)

      Actually I am trying the last one. I will let you know