asmar
(Mazin Asmar)
January 10, 2018, 1:04am
1
I am using the following C# code to disable a standard button during form load.
EpiButton ctrl = (EpiButton)csm.GetNativeControlReference(“32da3a44-bd26-454a-9376-e0f9ddde1e4b”);
ctrl.Enabled = false;
ctrl.Visible = false;
This code works in other forms for the referenced EpiGuid of the button.
However, in this form the Guid is different each time the form loads.
Error Detail
Message: Exception has been thrown by the target of an invocation.
Inner Exception Message: Control with specified EpiGuid property does not exist.
csm.GetNativeControlReference(“32da3a44-bd26-454a-9376-e0f9ddde1e4b”)
Program: CommonLanguageRuntimeLibrary
Method: InvokeMethod
Is there another method to disabling a standard button?
anyac
(Anya Chervinskaya)
January 10, 2018, 1:27am
2
Have you tried doing in under Properties tab and not in the script?
asmar
(Mazin Asmar)
January 10, 2018, 1:34am
3
No. But the reason being, I am disabling the button based on the security group assigned to the login user session. This works just fine in many other screen, but not from the Sales workbench. Very odd.
lucasn
(Lucas Nicks)
January 10, 2018, 1:42pm
4
Which button are you trying to disable in Sales Workbench?
asmar
(Mazin Asmar)
January 10, 2018, 2:02pm
5
Sales Management > Customer Relationship Management > General Operations > Salesperson Workbench screen > Orders tab> Open tab> Add button.
Note, I am able to disable the Order tab> By customer> Add button using the EpiGuid method:
EpiButton ctrl = (EpiButton)csm.GetNativeControlReference(“32da3a44-bd26-454a-9376-e0f9ddde1e4b”);
ctrl.Enabled = false;
ctrl.Visible = false;
asmar
(Mazin Asmar)
January 10, 2018, 2:02pm
6
I noticed that the EpiGuid for the button changes each time:
1.Turn customization mode on.
2.Open Sales workbench
3.Select Tools> Customizations
4.Click on the Orders tab, Open tab and Add button.
5.Note the EpiGuid value
6.Exit customization do not save anything.
7.Exist the form
8.Repeat steps 2 - 7
Mike
(Mike Watkinson)
January 11, 2018, 5:55am
7
Can you just do a BPM on whatever method the button uses to throw an error when someone who shouldn’t be clicking clicks?
tkoch
(Theodore Koch)
January 11, 2018, 1:38pm
8
You could loop the controls on the form and when you come across that button then disable it.
Chris_Conn
(Chris Conn)
January 11, 2018, 2:11pm
9
Interesting - is this a runtime dashboard? If so, that’s your problem. You’ll need to compile it to an assembly (Deploy) - then you’d do your customizations.
Chris_Conn
(Chris Conn)
January 11, 2018, 6:18pm
11
Excellent - throw me a solution then - I haven’t got one all year
2 Likes
asmar
(Mazin Asmar)
January 12, 2018, 3:41pm
12
Its only Jan 12th! I will do my best (if I understand your hint). Otherwise, please let me know what you mean?
Chris_Conn
(Chris Conn)
January 12, 2018, 5:42pm
13
I mean if my suggestion about compiling your dashboard solved this problem, mark it as the solution (with the checkbox under the post)
asmar
(Mazin Asmar)
January 12, 2018, 8:11pm
14
I will test this over the weekend to make sure.
Thanks