Read status from active form
Ronald Grentzius
Hello all,I want to read the document status value from the active form, to detect if the active form is a draft document. Draft documents should return 6 as value, but my code returns no value, is this possible?
[CODE]
string DocStatus = TextEdit.GetFromUID(pVal.Form, "81").Value.ToString();
if (DocStatus == "6")
{
MessageBox.Show(Message1, "OK");
}
[/CODE]
Thanks in advance for all help!
Friederike Mundt
Hi Ronald,Even if it does not look like it but the Document Status is of type ComboBox not a TextEdit.
You do not get a value because you get an exception casting the value for the DocStatus.
With the following line it should give you the expected result:
[CODE]string DocStatus = ComboBox.GetFromUID(pVal.Form, "81").Value.ToString();[/CODE]
Did you know you can get additional item info like position and type by clicking on a button "Item Info On" on the optimizer form?
Also I would suggest to always use try and catch in your code to check that there are no exceptions. See the following link [url="https://helpdesk.coresystems.ch/entries/21453748-gen-best-practise-coresuite-customize-rules-coding-templates-faq-10121"]https://helpdesk.coresystems.ch/entries/21453748-gen-best-practise-coresuite-customize-rules-coding-templates-faq-10121[/url] for some best practice and templates you can use for coresuite customize rules.
Hope this helps.
Cheers,
Friederike
Ronald Grentzius
Hello Friederike,Thanks for the support, It works! The exception rule was in the code, I didn't copy it to this thread sorry.
I will check the link with the templates, great. I also didn't knew about the item info button. I have no programming experience, so I'm learning by trying until I get it to work, sometimes with a little help
Best regards,
Ronald
Friederike Mundt
sounds cool. Good luck and enjoy the learning
0
Please sign in to leave a comment.
Comments
0 comments