Design Tip 3: Custom Actions on Form Buttons are just like Workflows

May 14, 2008 at 2:13 pm 6 comments

Form buttons can have Form Actions associated with them. Form Actions can contain Custom Actions. Custom Actions in Form Actions are configured just like workflows – the main difference is that they don’t initiate until the button is pushed. 

I have been moving a lot of my workflows into Custom Form Actions. I like the fact that they only get started when the button is pushed. For example, when a user edits a specification in my web application and clicks Save, the Custom Form Action checks the current status of the specification. If the specification was in Created status, it saves the specification and changes the status to In Progress. If the specification was in Review status, it emails all of the Reviewers to let them know it has been changed and then sets the status back to In Progress.

Important: I have come across one major problem using this tip. The Custom Form Actions don’t seem to have a workflow history. There is no way, that I can find, that allows me to see when the Custom Form Action ran, where it got stuck and what the current status is. This can be a nightmare when trying to troubleshoot any issues.

Workaround: I have created a custom list to track workflow statuses. After a workflow completes any step – I have it write to the custom list – this way when a workflow or custom form action fails, I can check what the last correct step was. I think that I will post a more in-depth topic on logging workflows.

Advertisements

Entry filed under: SharePoint Tips and Tricks. Tags: , , , , .

Design Tip 2: Deleting and Restoring a List Item destroys Workflows Design Tip 4: Turn Any Field in a Dataview into a Hyperlink

6 Comments Add your own

  • 1. tplunk  |  July 25, 2008 at 8:40 pm

    Hello.

    Thanks for this tip. I have worked on implementing it and have come to a stand still on what must be a simple problem. I have associated a Custom Action to a Form Actions button. All I want the action to do is update a field on the record in the form I am working with. So in the asscoiated workflow I
    1. specify an Asction of Update List Item.
    2. Choose the list that the data view webpart is based upon
    3. Then in the Update List Item dialog at the bottom where you look up the list item to update, for the Field Value, I select choose the list item “ID” field. In the Value field I specify to Lookup the ID value based on a Source of the “Form Fields” but then the Field drop down below it does not show any values – it is empty. I thought this is where I would choose the Form ID field.

    I hope this makes sense as I just want to update the list item based on them clicking the button the Data view Form webpart.

    Thanks in Advance!

    Reply
  • 2. ThiNg  |  August 18, 2008 at 9:56 pm

    Tplunk asked:

    Q: “In the Value field I specify to Lookup the ID value based on a Source of the “Form Fields” but then the Field drop down below it does not show any values – it is empty. I thought this is where I would choose the Form ID field.”

    A: This used to happen to me all the time when I first started, and it was because I would keep forgetting and try to link an ID to a non-number field. It coud be something else, but I would verify that the field you are comparing to the ID contains a numeric value. If it doesn’t and you really need to compare that field, you would need to convert the value to a number in the workflow (using conditions – if the value is “big” set variable = 1, etc) or link them to another list where the values are assigned numbers.

    Reply
  • 3. Josh  |  March 3, 2009 at 2:16 am

    I have the problem too. My SP Designer will not allow list item IDs in variables marked as numbers nor will it lookup list item ids based on a number column. Is this standard!?!?! I could have sworn it used to allow me to do this and just randomly stopped!!!! The Microsoft site says the 2 are interchangeable.

    JT

    Reply
    • 4. ThiNg  |  March 3, 2009 at 3:28 pm

      Josh,

      I definitely run into this issue when trying to compare List Item IDs to normal numbers. The only solution I have found is to create a number field called “ListName”ID and then have a workflow set the ListnameID to the ID field value whenever a new item is created. So if the ID for the new item is ‘5’ then the workflow would set the ListnameID field to ‘5’. Then you can compare items in the workflows as numbers, for example, checking to see if the ListNameID equals the ListNameID stored somewhere else.

      Let me know if you want a more detailed example…

      Reply
  • 5. Poolio  |  September 28, 2009 at 2:43 pm

    I’m currently struggling with this too. I’ve learned from prior experience that you can’t compare against the ID field, it’s a nightmare. So I always do what ThiNg suggested when I’m using SPD workflows, and it works fine.

    However, this is not working for me in custom form actions. I have a standard number column (which is generated by a workflow to = ID, but that’s irrelevant really), and I have a form field which corresponds to it. But no matter how I format it (number, form field, string) I cannot reference it in a custom form action. The drop-down of form fields is completely blank.

    The only way I can get to see it is if I set a workflow variable (string type), and then the field shows up in Form Fields dropdown. But that’s not much use, as the variable is in string type so I still can’t compare it against the number field!

    Any help very gratefully received, it’s driving me mental.

    Reply
  • 6. ThiNg  |  September 28, 2009 at 2:57 pm

    @poolio

    I stopped using the custom form actions a while back because I found them to be a really pain in the backside. I will try to test this scenario when I have a chance…

    But as you can tell, with no posts in the last year, I am super busy at work.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed



%d bloggers like this: