Solved

Email Event Action help


Userlevel 5
Badge +15

Hello,

I need assistance with getting the Event Action type “Email” working. I’m having an issue with my custom attribute field in the event, and this is the error I get when trying to run the event action:

Any and all help would be appreciated.

Thanks,
Bryan

icon

Best answer by anmise 10 May 2023, 21:23

View original

28 replies

Userlevel 5
Badge +15

If those images are too small, here are larger images.

 

Userlevel 5
Badge +15

I’ve tried using this method for my Custom Attribute
 

But I now get this error
 

Which makes me think I either have to define the schema (Not sure if that is true based off of the logs and action calls in the debug menu) or this function is not available/ I don’t have access to this function call. Is there any documentation on this formatting I could use? 

Thanks,
Bryan

Userlevel 5
Badge +15

Even this hasn’t worked.

How do IFS Cloud Projections relate to APIs? Aren’t projection actions essentially just API calls? 

Userlevel 7

Even this hasn’t worked.

How do IFS Cloud Projections relate to APIs? Aren’t projection actions essentially just API calls? 

Who are you trying to send the email to? Let’s say it’s the main contact, then you need to use something like this:
 

Comm_Method_API.Get_Value('PERSON', main_contact_id, Comm_Method_Code_API.Decode('E_MAIL'))

Just replace main_contact_id with &OLD:MAIN_CONTACT_ID

You cannot use a select statement in the server method for custom attributes.

Userlevel 5
Badge +15

Hi @anmise 

I really appreciate the reply, especially with how quick it was.

Yes I am trying to email the main contact. I tried adding that into the custom attribute and I swapped the main_contact_id with the &OLD:MAIN_CONTACT_ID but I got this error:

Luckily, I tried this with &NEW:MAIN_CONTACT_ID and It didn’t give me an error!

I will have to turn on the emailer and try this. Thanks! I truly appreciate the help!
Thanks again!
Bryan

Userlevel 5
Badge +15

Hi @anmise 

Thanks again for the answer.

 

For future reference, where were you getting those two API calls? I cannot find any documentation on IFS API’s other than Projection calls in the API Explorer. I’m assuming I can access this via the IFS Developer Studio and look at the API’s directly, but I’m waiting to take IFS Cloud Developer courses before I start working with that.

Thanks,
Bryan

Userlevel 7

Hi @anmise 

Thanks again for the answer.

 

For future reference, where were you getting those two API calls? I cannot find any documentation on IFS API’s other than Projection calls in the API Explorer. I’m assuming I can access this via the IFS Developer Studio and look at the API’s directly, but I’m waiting to take IFS Cloud Developer courses before I start working with that.

Thanks,
Bryan

No worries. Unfortunately just from experience, and not something I think you’d easily be able to figure out through the front end (there might be a way I’m not aware of). PL/SQL APIs are being replaced by projections to a large extent, but sometimes there’s no other way.   

Userlevel 5
Badge +15

Hi @anmise 

Thanks again for the answer.

 

For future reference, where were you getting those two API calls? I cannot find any documentation on IFS API’s other than Projection calls in the API Explorer. I’m assuming I can access this via the IFS Developer Studio and look at the API’s directly, but I’m waiting to take IFS Cloud Developer courses before I start working with that.

Thanks,
Bryan

No worries. Unfortunately just from experience, and not something I think you’d easily be able to figure out through the front end (there might be a way I’m not aware of). PL/SQL APIs are being replaced by projections to a large extent, but sometimes there’s no other way.   

Hi @anmise That’s unfortunate. I think that should be documented but if it’s something I can see via Developer Studio, then hopefully it won’t be an issue for me in the future. It is a shame that IFS isn’t documenting this as it really would help the customers who don’t have that back-end access. I posted the idea for expanding workflow capabilities like you mention in my other post, so thank you again for that. 
Thanks again for all of the help, I appreciate you taking the time to give me those API calls,

Bryan

Userlevel 5
Badge +15

Hello again @anmise,

Thanks again for answering my question. I’m wondering if you know what API calls I’d have to use to get the equivalent of the BusinessOpportunityHandling.GetRepsToSendEmail function call. I’d like to get the main rep for this Business Opportunity so I know who to put as the sender. 

 

Also another IFS Employee just replied to another post saying that these PL/SQL executions are going to be ‘discontinued’ from future updates. Do you know if that will stop my Custom Attribute API calls that I’m currently making?

Thanks again,
Bryan

Userlevel 5
Badge +15

Thinking about this more, would IFS Cloud automatically get the email for these accounts if you only use their IDs? For example, if I have just this

I’m wondering if IFS would fetch that information by itself, since it’s not explicitly asking for an email. I have to wait to test as our emailer isn’t up, but It was something I was thinking about after I saw some documentation saying that IFS will fetch certain information by itself (I cannot find where that document lived)

Userlevel 5
Badge +15

Hi @anmise 

 

Thanks again for helping me out with the API calls. Unfortunately.. I don’t think those API calls worked. I keep getting the error “Mail address 'To' field is not specified” when I use “&CONTACT_EMAIL”. That custom attribute has the 

“Comm_Method_API.Get_Value('PERSON', &NEW:MAIN_CONTACT_ID, Comm_Method_Code_API.Decode('E_MAIL'))” 

values we discussed before.

Unless I am formatting this incorrectly (I’ve tried using #CONTACT_EMAIL#, &CONTACT_EMAIL, and just CONTACT_EMAIL but all have resulted in the same error) I believe the issue might be with the API calls. I’ve tried just putting my email in that To: field and it worked.

Any insight would be greatly appreciated.

Thanks,
Bryan

Userlevel 7

Hello again @anmise,

Thanks again for answering my question. I’m wondering if you know what API calls I’d have to use to get the equivalent of the BusinessOpportunityHandling.GetRepsToSendEmail function call. I’d like to get the main rep for this Business Opportunity so I know who to put as the sender. 

 

Also another IFS Employee just replied to another post saying that these PL/SQL executions are going to be ‘discontinued’ from future updates. Do you know if that will stop my Custom Attribute API calls that I’m currently making?

Thanks again,
Bryan

Sorry for the late reply. You’d use the same function as above, but switch the main_contact_id to main_representative_id (or &NEW:MAIN_REPRESENTATIVE_ID in your case I guess)
 

Comm_Method_API.Get_Value('PERSON', main_representative_id, Comm_Method_Code_API.Decode('E_MAIL'))

PL/SQL functions will not disappear overnight and your custom attribute will work fine for the foreseeable future

Userlevel 7

Thinking about this more, would IFS Cloud automatically get the email for these accounts if you only use their IDs? For example, if I have just this

I’m wondering if IFS would fetch that information by itself, since it’s not explicitly asking for an email. I have to wait to test as our emailer isn’t up, but It was something I was thinking about after I saw some documentation saying that IFS will fetch certain information by itself (I cannot find where that document lived)

No it wouldn’t as all it’s doing is replacing that with the value from the field, however if there was a field called MAIN_REP_EMAIL then you could just put &NEW:MAIN_REP_EMAIL in the From User field.

Userlevel 5
Badge +15

Hello again @anmise,

Thanks again for answering my question. I’m wondering if you know what API calls I’d have to use to get the equivalent of the BusinessOpportunityHandling.GetRepsToSendEmail function call. I’d like to get the main rep for this Business Opportunity so I know who to put as the sender. 

 

Also another IFS Employee just replied to another post saying that these PL/SQL executions are going to be ‘discontinued’ from future updates. Do you know if that will stop my Custom Attribute API calls that I’m currently making?

Thanks again,
Bryan

Sorry for the late reply. You’d use the same function as above, but switch the main_contact_id to main_representative_id (or &NEW:MAIN_REPRESENTATIVE_ID in your case I guess)
 

Comm_Method_API.Get_Value('PERSON', main_representative_id, Comm_Method_Code_API.Decode('E_MAIL'))

PL/SQL functions will not disappear overnight and your custom attribute will work fine for the foreseeable future

Hi @anmise thanks! It seemed pretty obvious but I wasn’t 100% sure if the same API call would work. 

 

Now the only thing left to do is see why the Event Action isn’t accepting these values, which might be due to the API methods themselves. The error I mentioned before “To' field is not specified” indicates (at least to me) that it’s not receiving a value from the API calls. Do you have any thoughts on this? and if you are busy as I’m assuming you are, is there someone that I might be able to reach out to regarding this?

Thanks again, I appreciate it,
Bryan

Userlevel 7

Hello again @anmise,

Thanks again for answering my question. I’m wondering if you know what API calls I’d have to use to get the equivalent of the BusinessOpportunityHandling.GetRepsToSendEmail function call. I’d like to get the main rep for this Business Opportunity so I know who to put as the sender. 

 

Also another IFS Employee just replied to another post saying that these PL/SQL executions are going to be ‘discontinued’ from future updates. Do you know if that will stop my Custom Attribute API calls that I’m currently making?

Thanks again,
Bryan

Sorry for the late reply. You’d use the same function as above, but switch the main_contact_id to main_representative_id (or &NEW:MAIN_REPRESENTATIVE_ID in your case I guess)
 

Comm_Method_API.Get_Value('PERSON', main_representative_id, Comm_Method_Code_API.Decode('E_MAIL'))

PL/SQL functions will not disappear overnight and your custom attribute will work fine for the foreseeable future

Hi @anmise thanks! It seemed pretty obvious but I wasn’t 100% sure if the same API call would work. 

 

Now the only thing left to do is see why the Event Action isn’t accepting these values, which might be due to the API methods themselves. The error I mentioned before “To' field is not specified” indicates (at least to me) that it’s not receiving a value from the API calls. Do you have any thoughts on this? and if you are busy as I’m assuming you are, is there someone that I might be able to reach out to regarding this?

Thanks again, I appreciate it,
Bryan

Are you including the ampersand (&)? It’s important.

Userlevel 5
Badge +15

Hello again @anmise,

Thanks again for answering my question. I’m wondering if you know what API calls I’d have to use to get the equivalent of the BusinessOpportunityHandling.GetRepsToSendEmail function call. I’d like to get the main rep for this Business Opportunity so I know who to put as the sender. 

 

Also another IFS Employee just replied to another post saying that these PL/SQL executions are going to be ‘discontinued’ from future updates. Do you know if that will stop my Custom Attribute API calls that I’m currently making?

Thanks again,
Bryan

Sorry for the late reply. You’d use the same function as above, but switch the main_contact_id to main_representative_id (or &NEW:MAIN_REPRESENTATIVE_ID in your case I guess)
 

Comm_Method_API.Get_Value('PERSON', main_representative_id, Comm_Method_Code_API.Decode('E_MAIL'))

PL/SQL functions will not disappear overnight and your custom attribute will work fine for the foreseeable future

Hi @anmise thanks! It seemed pretty obvious but I wasn’t 100% sure if the same API call would work. 

 

Now the only thing left to do is see why the Event Action isn’t accepting these values, which might be due to the API methods themselves. The error I mentioned before “To' field is not specified” indicates (at least to me) that it’s not receiving a value from the API calls. Do you have any thoughts on this? and if you are busy as I’m assuming you are, is there someone that I might be able to reach out to regarding this?

Thanks again, I appreciate it,
Bryan

Are you including the ampersand (&)? It’s important.

Yes, I have that included in both the custom attributes

as well as the custom event action parameters for the email

 

Userlevel 5
Badge +15

Also @anmise I just checked the BUSINESS_OPPORTUNITY table and for the BO that I was testing, both the Main_Contact_Id field and the Main_Representative_Id fields were populated. I looked both us via the Person page and both exist and have emails associated to them.

Thanks,
Bryan

Userlevel 7

Can you replace &NEW: with &OLD: 

Don’t to forget to enable the old value for those two fields

 

And make sure to wrap the values in the get method in single quotes.
 

Comm_Method_API.Get_Value('PERSON', '&MAIN_CONTACT_ID', Comm_Method_Code_API.Decode('E_MAIL'))

Userlevel 5
Badge +15

Hi @anmise 

I’ve enabled the old values of the two fields, I just tried that and it didnt work. I tried adding the values in single quotes and that didnt work either unfortunately.

I also tried your example with just the “Comm_Method_API.Get_Value('PERSON', '&MAIN_CONTACT_ID', Comm_Method_Code_API.Decode('E_MAIL'))” and that sadly didn’t work as well.

Userlevel 5
Badge +15

Hi @anmise could it be that the ‘E_MAIL’ portion isn’t using the same formatting we are?

 

I went to the Person page for the main contact and this is what I saw 

We are using E-Mail but I’m not sure if that even matters

Userlevel 7

Hi @anmise could it be that the ‘E_MAIL’ portion isn’t using the same formatting we are?

 

I went to the Person page for the main contact and this is what I saw 

We are using E-Mail but I’m not sure if that even matters

Ok, sorry for the mess. I had to test it out myself. This works for me.

 

Comm_Method_API.Get_Value('PERSON', &OLD:MAIN_CONTACT_ID, Comm_Method_Code_API.Decode('E_MAIL'))

Please give that a go. 

 

 

Userlevel 5
Badge +15

Hi @anmise could it be that the ‘E_MAIL’ portion isn’t using the same formatting we are?

 

I went to the Person page for the main contact and this is what I saw 

We are using E-Mail but I’m not sure if that even matters

Ok, sorry for the mess. I had to test it out myself. This works for me.

 

Comm_Method_API.Get_Value('PERSON', &OLD:MAIN_CONTACT_ID, Comm_Method_Code_API.Decode('E_MAIL'))

Please give that a go. 

 

 

Sadly this still didn’t work, I’m getting the same “Mail address 'To' field is not specified” error unfortunately.

This is the correct formatting for the email fields right?

 

Userlevel 5
Badge +15

@anmise 

I’m so sorry, you’re going to hate me, I just tested on multiple Business Opportunities and a few of them worked. It must be something related to how the email is saved on some of the contacts. It works and I can’t thank you enough for helping me out. I truly appreciate it.
Thank you!
Bryan

Userlevel 7

@anmise

I’m so sorry, you’re going to hate me, I just tested on multiple Business Opportunities and a few of them worked. It must be something related to how the email is saved on some of the contacts. It works and I can’t thank you enough for helping me out. I truly appreciate it.
Thank you!
Bryan

It will only work for the contact that is flagged as “Main” on the opportunity. Have you checked for the ones you’ve tested and made sure that this contact has an email address defined on the line?

Great to here that we’re making some progress at least. :)

Userlevel 5
Badge +15

Hi @anmise 

All of them were flagged as main, I think it has something to do with one contact, as every BO email that failed had the same contact. It might be because they have a weird email (rocketmail) but that contact was a test contact anyways so I’ll take it! Thanks again : )

For a related question, what would be the API call for getting the contact name (first or full name) or the company name? 

Again, thank you so much for all of the help, you are amazing.
Bryan

Reply