on 09-10-2014 5:46 PM
Hi experts!
I've been having some issues with the Message Template Language when using the NotificationUtil to send an Email.
How do I set the language of the template?
Do i set this by the sender? Or do I need to reference the recipient?
If so, how could I get the Account Object Interface from the user given that I got him as a collaborator?
I wish you could help me out whit this language problem.
Here's an example of the code I'm using:
Properties params = new Properties();
params.put(new String("PHASE_NAME"), faseName);
params.put(new String("DOCUMENT_TYPE"), docType);
params.put(new String("DOCUMENT_NAME"), contractName);
params.put(new String("OWNER_FIRST_LAST_NAME"), owner.toString());
params.put(new String("START_DATE"), fecha);
params.put(new String("INSTRUCTION"), "");
params.put(new String("DOCUMENT_HEADER_URL"), vinculo);
String[] recipients = {mail};
sender = session.getAccount();
mailTypeEnum = new MailTypeEnumType(MailTypeEnumType.ODP_WORKFLOW_APPROVAL_REQUEST_MSG);
NotificationUtil.sendNotification(recipients,sender, mailTypeEnum,params,null,null);
Thanks in Advance!
Hi Oscar,
There are 2 flavors of the sendNotification method, one takes IapiAccountIfc for recipient and the other takes a String array for recipients. Looks like you are using the one that takes a String array by passing a list of recipients email id. I'd suggest using the first one by passing the IapiAccountIfc for the recipient and the email sent out will be in the default language of that user. The default language for the user is set on the user account object.
Hope this helps.
Regards,
Vikram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi vikram!
Sorry for the still inconvenience, but I'm getting this error:
Error in method invocation: Static method sendNotification( com.sap.odp.usermgmt.masterdata.UserAccountBo, com.sap.odp.usermgmt.masterdata.UserAccountBo, com.sap.odp.api.comp.messaging.MailTypeEnumType, java.util.Properties, null, null ) not found in class'com.sap.odp.api.util.NotificationUtil'
Im making the code the following way:
Properties params = new Properties();
params.put(new String("PHASE_NAME"), faseName);
params.put(new String("DOCUMENT_TYPE"), docType);
params.put(new String("DOCUMENT_NAME"), contractName);
params.put(new String("RECIPIENT_FIRST_NAME"), nombre);
params.put(new String("OWNER_FIRST_LAST_NAME"), owner.toString());
params.put(new String("START_DATE"), fecha);
params.put(new String("ORG_UNIT"), orgUnit);
params.put(new String("INSTRUCTION"), "");
params.put(new String("DOCUMENT_HEADER_URL"), vinculo);
recipients = IapiAccountLocator.lookup(session, collaborator.getPrincipal()); // This Changed.
( I also tried like this:
IapiAccountIfc recipients = IapiAccountLocator.lookup(session, collaborator.getPrincipal());)
sender = session.getAccount();
mailTypeEnum = new MailTypeEnumType(MailTypeEnumType.ODP_WORKFLOW_APPROVAL_REQUEST_MSG);
NotificationUtil.sendNotification(recipients,sender, mailTypeEnum,params,null,null);
Thanks again!
Hi Oscar,
Couple of things....
The two flavors of sendNotification method has different method signatures. Please take a closer look at the IAPI.
For example, the parameter notificationType is an Integer not MailTypeEnum.
It will be something like this....
sendNotification(recipients, sender, new Integer(401), params);
Here 401 is nothing but the custom template 1. You can find this in the messaging.MailTypeEnum class on the reference guide.
Regarding collaborator variable - May be you have defined it somewhere in your script but I didn't find it in the code snippet you provided. To iterate through the collaborator collection, the code will look something like this....
docCollabIter = doc.getCollaborators().iterator();
while(docCollabIter.hasNext()){
collab = docCollabIter.next();
collabUserObjRef = collaborator.getPrincipal();
}
Hope this helps.
Regards,
Vikram
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.