Hi. I’m trying to use in_Config(“UiDemoPath”).ToString for URL and also one for Credentials but when I enter in_Config(“UiDemoPath”).ToString it gives me error that its not declared. I have tried running InitAllSettings as well but that didn’t help.
Hi.
If your intent is to use the values directly from your dictionary that is stored in the Main, then you will need to pass it in to your UiDemo_Login workflow as an in Argument. So you need to create an In argument called in_Config that is a dictionary <Of String, Object>
Although, I don’t recommend this approach for shared snippets, because then it always relies on a dictionary to read in values and so you would need to run it from the Main each time you need to test the workflow. In that case, you would instead create an argument for each value the workflow will be using rather than using the dictionary.
Regards.
Thanks for the response. I totally agree with you but my understanding is for Level three assignments 1 & 2 we have to use this approach.
I did create in_config argument and imported it during invoke process and created credential argument in GetAppCredential but it still gives error as GetAppCredential is not getting the values of config file. This is where I’m confused about the purpose of Importing Arguments doesn’t it suppose to passthrough values?
The way it’s supposed to work is like this:
Let’s say you have some workflows, InitSettings.xaml, Main.xaml (which is the State Machine), Login.xaml, GetCredential.xaml, or any others.
The InitSettings.xaml is where the Configuration dictionary is initially created, therefore inside that workflow, it will have an OUT argument called out_Config.
The Main.xaml then stores that argument to a “variable” (not argument) called Config. This is set in the Invoke Workflow that calls the InitSettings.xaml, where the out_Config gets stored to the Config variable.
Then, for every other workflow that uses this dictionary should have an IN argument. The Login.xaml has an IN argument called in_Config, and if you have a workflow called GetCredential.xaml then it will have an IN argument also called in_Config. These arguments are declared inside the workflow file. So, when you use the Import on the Invoke Workflow file, then it brings in the arguments.
Now, that the in_Config is declared correctly, you shouldn’t have any errors saying it’s not declared and that the value is passed into each workflow correctly.
I hope I was clear
Let me know if you get any other errors. Also, if you can show screenshots of the errors that will be helpful, and if it’s a “not declared” message then show your arguments pane too.
Regards.
Thank you so much for the explanation. As you stated “These arguments are declared inside the workflow file. So, when you use the Import on the Invoke Workflow file, then it brings in the arguments.” the problem I’m facing is that its not passing the arguments to “in_Credential” argument in GetCredtial.xaml.
I have attached System1_Login & GetAppCredential arguments please have a look. In system1_Login even though I have created in_Config argument, its still giving me error “Not Declared” (It wasn’t there before but now just came).
I have one more question, related to your explanation. Do I have to run Main.xaml every time I want to test any sequence? would it give error until I run IntAllSettings?
Yeah, if it relies on in_Config to run, then it needs to go through the InitSettings before it can run.
As for the “not declared” error that is showing at the bottom of your screenshot,
You cannot use a variable or argument that has not yet been declared, and it declares them in this order: Arguments, Global Variables, then by scope after that. So since you are trying to use in_Config in the Arguments, it has not been declared yet because Arguments are declared when the Workflow first starts to run.
Seeing as how you are wanting to store the URL and Credential there, you have 2 options. You can A) delete those arguments and create variables then use in_Config() as the Default value exactly how you are doing it -you would only need to have 1 argument to pass all the settings in this case, or B) delete the Default value from the 2 arguments, and instead place that inside the Invoke Workflow file that calls the System1_Login workflow file… if that makes sense.
Your Invoke Workflow that calls the GetAppCredentials is fine. But you can either use the in_Config setting directly or use the variable that gets stored the setting at the start like you were trying to do. But, like I said, you can’t use in_Config as the Default value in the Arguments, because it doesn’t get declared until the Workflow starts (and all Arguments get declared at the same time before variables, so in_Config doesn’t exist yet)
I hope this extra info helps. Regards.
Thank you for further clarification. It all make sense but whenever I put it in practise, it doesn’t work. Now its giving me error: Loading asset Systm1Credential failed: Could not find an asset with this name. Error code: 1002. The asset with this name exists in Orchestrator and I have deleted & recreated it. I have tried using it directory and it works but when I try to pass it through Config file it throws this error.
I would suggest verifying that the string used in the Get Asset activity matches the asset name found in Orchestrator. You can check this with like a write line or Message Box. Then, if there is an issue there you can backtrack and identify the issue.
Feel free to upload or PM a zipped copy of your project, and I can check it and figure out what’s wrong easier. Just make sure you remove anything that references your company that it is for.
Regards.