iLogic Forms: Why no "On Click Action" for External rule buttons?

iLogic Forms: Why no "On Click Action" for External rule buttons?

DRoam
Mentor Mentor
5,835 Views
8 Replies
Message 1 of 9

iLogic Forms: Why no "On Click Action" for External rule buttons?

DRoam
Mentor
Mentor

The images below show the issue in question. I have two questions:

 

  1. WHY isn't the "On Click Action" setting available for External rule buttons?
  2. Is there a workaround for this? Maybe a way to get the External rule to close the form after running?

Thanks for any suggestions.

 

Options for a Local Rule button:

Form On Click Action - Local Rule.png

 

Options for an External Rule button:

Form On Click Action - External Rule.png

5,836 Views
8 Replies
Replies (8)
Message 2 of 9

cmcconnell
Collaborator
Collaborator

It would be very helpful to have this functionality

Mechanix Design Solutions inc.
Message 3 of 9

philip1009
Advisor
Advisor

That is strange, sounds like another good idea for the Inventor Ideas forum.  A workaround off the top of my head is to have a regular rule as the button and in that rule have the single line to run the external rule:

SyntaxEditor Code Snippet

iLogicVb.RunExternalRule("ruleFileName")

 

When you make the post in the ideas forum, link it here to gather support on it.

Message 4 of 9

DRoam
Mentor
Mentor

Just made a really interesting discovery--one that allows you to set the "On Click Action" for External rules!

 

I remembered that iLogic forms are controlled by XML files. A little experimenting confirmed that you can actually edit the XML file (with one very simple edit) and use any of the On Click actions for External Rules buttons.

 

You can only do this for Global Forms, not local document Forms, because there's no XML file to edit for local Forms. But there's a simple workaround for that: just copy/paste your Local Form into the Global Forms area, perform the workaround, then copy/paste the form back into the local document Forms area.

 

All that said, here are the instructions for the XML workaround:

 

  1. Right-click in an empty area of the Global Forms tab, and click Open Containing Folder.
  2. Locate the file with the name of your form (the one WITHOUT .state at the end). Right-click the file, point to "Open With", and click "Notepad".
  3. Hit Ctrl+F and type the name of the External iLogic rule. Click "Find Next" until it highlights a line that says <RuleName> at the beginning.
  4. Directly below this line should be a line that starts with <RuleButtonBehavior> (this is the "Start Tag") and ends with </RuleButtonBehavior> (this is the "End Tag"). Right now it should say "RunRule" between the Start and End Tags.
  5. Erase the the text that's currently between the Start and End Tags, and replace it with the appropriate text for the action you want (see table below).
  6. Save the XML file and close it.
  7. The External iLogic button should now perform the desired "On Click Action".

 

Here are the respective RuleButtonBehavior values for each On Click Action:

          On Click Action               |     RuleButtonBehavior
===================================================================
Run Rule                                |  RunRule
Close and then Run Rule                 |  CloseAndRunRule
Apply and then Run Rule                 |  ApplyValuesAndRunRule
Apply and then Close and then Run Rule  |  ApplyValuesCloseAndRunRule

 

Again, the respective RuleButtonBehavior value should go between the start and end tags in the XML file. So if you want the On Click Action to be "Close and then Run Rule", then the line below <RuleName> in your XML file should look exactly like this:

 

<RuleButtonBehavior>CloseAndRunRule</RuleButtonBehavior>

 

As far as I can tell, you're free to edit the External rule button using the Form Editor after this (such as to give it a tooltip), and it won't wipe out the On Close Action that you gave it.

 

There could be some undesired consequences from doing this, but as far as I can tell it's perfectly safe. It's simply changing a property that's already present in the button's underlying code, but for some reason isn't exposed in the Rule Editor UI. If anyone runs into any issues with it though, please let me know.

 

So unless this causes any issues, I can't see any reason why this wasn't exposed in the UI... would definitely be nice if it could be added in so we don't have to go through all this hassle.

Message 5 of 9

DRoam
Mentor
Mentor

Curious if any of the Autodesk devs can comment on why this setting wasn't exposed to the Form Editor UI? ... (@chandra.shekar.g@YuhanZhang@MjDeck)

0 Likes
Message 6 of 9

Anonymous
Not applicable

Thank you so much DRoam!

As far as I can tell after the first test, this solutions workes fine for me.

Hope to find it in the standard UI anyways.

 

Thanks

0 Likes
Message 7 of 9

machiel.veldkamp
Collaborator
Collaborator

Hi @DRoam 

 

I tried this out in a Global form to atcivate External Rule

 

I editted the xml file like you said but I don't see any change in the global form.


Any idea why it wouldn't function? Maybe because it's a global form?

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

___________________________
0 Likes
Message 8 of 9

Mike_Y2
Advocate
Advocate

I have successfully followed the above instructions (Global form and External rules)

 

Thanks for the info!!!

 

It is a problem I have had for a while and until now been unable to solve it or find an answer on the forums

0 Likes
Message 9 of 9

FeelGoodGirl
Advocate
Advocate

This function is not yet available. I hadn't seen the idea with Inventor Ideas either. I just put him in there. Please vote up the idea. Thank you in advance.

 

https://forums.autodesk.com/t5/inventor-ideas/add-on-click-action-for-external-rules/idi-p/9786602

0 Likes