All,
I am trying to call AddLogFields from a custom activity that I created in Visual Studio; however, those fields are not visible the log message.
Both Automation Name and Process Frequency are custom fields that I want to write. My custom package/activity runs successfully.
Code Snippet
Dictionary<String, InArgument> NewFieldsDictionary = new Dictionary<String, InArgument>
{
{ “Automation Name”, this.Automation_Name},
{ “Process Frequency”,new InArgument(chosenProcessFreq)}
};
UiPath.Core.Activities.AddLogFields addlog = new UiPath.Core.Activities.AddLogFields()
{
Fields = NewFieldsDictionary
};
WorkflowInvoker workflowInvoker = new WorkflowInvoker(addlog);
workflowInvoker.Invoke();
Any help would be greatly appreciated.
Studio Version: 2022.
1 Like
Hey @Dwayne_Shaw
Could you please explain the purpose of adding log fields inside the custom activity ?
Thanks
#nK
kvkpsd
(kp)
July 31, 2023, 1:48pm
3
Hi @Nithinkrishna ,
I have a similar requirement adding additional log field named “code” which is in addition to log message. I have the same code above but it doesn’t work from a custom activity. Any idea how to make this working?
Thanks,
KP
1 Like
kvkpsd
(kp)
July 31, 2023, 1:49pm
4
Hi @Dwayne_Shaw , were you able to see any luck with this?
Hi,
I was able to figure it out using a custom workflow, checking the parameters, and using the standard Add Log Details activity.
It actually has been in use across my organization for over a year now.
Best,
Dwayne
kvkpsd
(kp)
July 31, 2023, 2:30pm
6
Hi, can you please explain a little more on how to do that ?
1 Like
Hey @kvkpsd
You want to add a log field into each of your log ? Is that the requirement please ?
Thanks
#nK
kvkpsd
(kp)
August 1, 2023, 9:37am
8
yes @Nithinkrishna , that is my requirement and it is required to send specific codes based on the custom activity execution.
1 Like
Hey @kvkpsd
I see the possibility in 3 ways,
Use Logs endpoint to submit logs to Orchestrator
Use coded automation to access log message activity in code
Try using the Coded Automation supported UiPath library directly in your custom activity code
Hope this helps.
Thanks
#nK
kvkpsd
(kp)
August 4, 2023, 10:08am
10
Hi @Nithinkrishna , Thank you so much for sharing the details. If possible will you be able to share me some code/sample for above three?
Thank,
KP
1 Like