Invoke workflow arguments error

Hi guys,

I have built a component to email the reports which are produced through my automation, and I am invoking this within its own “State”. My problem is that when I use the following:


I get an error, which states that “Send SMTP Mail Message : Object reference not set to an instance of an object.”

So I assume from this something being called in is “incorrect”. To bypass this I can copy/paste the values from the config file and place them between quotes, and the component works as intended. I can’t seem to troubleshoot this myself, and am perhaps overlooking something relatively simple, does anyone have any ideas? The email address are separated by commas, and are not hyperlinks. The subject of the email contains a & sign, however when copied in directly this works fine, and the file location works fine in all other components it is invoked within. My only thought could be the & in the subject, but does anyone have an idea around this, as the email subject has to contain that (not my choice!).

Thanks!

Alex

1 Like

Hi @Alex_Cross

Did you try to print all the values in Parent workflow? It clearly seems to be something missing which is required for SMTP activity

Or if you can share a sample

Thanks,
Prankur

Hi @Alex_Cross

I guess you are missing to set some of the Send SMTP mail message activity properties.

Please re-check the properties like server, port, username, password…

Regards,
Karthik Byggari

I first thought it would be a missing port/etc, but as I said, when I type the arguments in manually I don’t get an error, it’s only when it calls the arguments in from the config file, which are only Subject, list of email addresses to send to, CC list, and the location of the attachments?

@PrankurJoshi thanks, I will try and print them out now, to see what is pulled and let you know!

So I have created a sandbox/test environment, and copied in this invoke there, and have changed ONLY the imported arguments, and I have copy and pasted these from the config file - therefore I can only assume that something in these arguments is causing the issue.

I have created log messages and it appears that the values are being pulled in correctly and that the config file is a known argument so it can read from it, so does anyone have any ideas of anything simple I might be missing?

Hi Prankur,

I am attaching the xml file, and as I said, on its own, this works, and emails me as desired. For whatever reason, when this is included within the main workflow however, it seems to error out as above, even though other than the arguments nothing has been changed. Many thanks for any time you can spend helping me with this!

UPSMTP_OpenPopulateNewEmail.xaml (23.6 KB)

So when you run it individually it works end to end without any error?
The email comes out well without any error?

Hi @Alex_Cross
Can you share the config file ? and I didn’t find any activity in your workflow where you are reading all the details from the config file. I mean you are passing all those arguments from the config file then there should be an activity to read the data from config file.

Correct yeah, works just fine on its own.

This is within an “Email State” I created in a ReFramework within the standard UiPath template, so the config is read in “INIT” and passed in here. I did think it was having trouble reading from the config file, but also when I manually type in the values here, it also errors out with the same error.

Where the following are the arguments

Thanks

I have tried copying the INIT invoke which initialises the config file into this “Email State” and still receiving this error.

When I have tried copying these two invokes into my sandbox (so config is there, ie I’m now changing NOTHING) they work perfectly, has anyone got a clue why this is happening? Thanks!

What about the username and password?

It’s smtp so does not require them? It works just fine without in the test mode

Actually i tested you xaml individually and via an invoke and its working fine.
Just that im not using the smtp and the error you are getting is related to that only.

Wondering what you may be doing differently when doing the invoke that your smtp fails

Your arguments are in sync?

When I copy the invoke into my test component it works just fine with the identical arguments so I can’t see them being wrong?

I have a log message before the invoke, which appears, so the “Email State” is activating, but the invoke is not opening (as the log message right at the start of it doesn’t appear).

A work around could be not to use arguments and just invoke the “initialise settings” activity within the email component to get the config info in, then assign them inside the component? I’d rather understand why the identical invoke works for you and my test environment, but not in the main project…

I believe the issue is now different. Your invoke dosent work.

i dont think that the issue is with the config variables.
It will just fetch you the values, given that your config is having those fields.
can you share what your config looks like for these fields? You can mask confidential details.

I have filtered as well, to show just the relevant ones, actual config file isn’t filtered.
These work just fine in the test component.

Your config looks good.
Have you tried to debug as to why the invoke is broken?
Are you getting any different error now? or still the smtp erro?

Still the same error, and debug in test mode works fine. In project it looks like it just stops at the invoke with the same error?

I also deleted and recreated the invoke from scratch in case it was being funny for that reason, but it made no difference.

it goes inside your workflow?