Workflow not passing values

  • 12 September 2017
  • 3 replies
  • 10 views

Badge +4

I have created a user exit smartform, it is using a list in sharepoint to save the data.  I have some code that gets processed when a field is changed, this code checks a user object in AD for a value and returns true or false depending on the value it finds.  The code then is saving the value to a datafield like so:

 

K2.ProcessInstance.DataFields["AD_Parameter"].Value = "100";

i can see in the process overview that the datafield is getting this new value, however in the smartform in the start workflow action when i set  the output mappings to pass this value to a form parameter it does nothing.  the parameter remains empty.

 

Am i doing this correctly?  I have even tried using a ticker control to slow down the processing of the form but that is making no difference.

 

does anyone have some guidance?

 

thank you,

Danny


3 replies

Hi!  


I don't think so :) 

 

Since you have the data field working in your workflow, consider adding the parameter to the end of the task form URL you're using to get to your item:

ex.  https://servername/runtime/form/my+form/?AD_Parameter=[AD_Parameter Lookup]&SN=[SerialNo Lookup]

 

I believe this is how form parameters are meant to be used.  If you're trying to set a form parameter without reloading your form or loading it in through a URL, I don't think K2 will see it.

 

Alternatively, if you want to store data on the fly in your form, consider using a hidden field and using that to store the value before calling your form logic.

 

Hope this helps,

David

 

Badge +4

How do i store it in the hidden field if i can't get the value that would go in the hidden field from the DataField in the workflow? 

 

Can i put something in my code that would update a field in my smartform?

Sorry for the late reply...  Let me try and break it down 

 

1. Smartform field changed, which is your event.

2. Code executes on that event and sets value for AD_Parameter. (This is what you'll want to set into your hidden field on the form, not a form parameter as form parameters don't get updated during runtime, to my knowledge.  I'm not sure how to do this with code but I'm quite positive that it can be done.  Ideally, it would be done through a rule/smartobject call.)

3. When you kick off your workflow, you can use input mapping to provide the hidden AD_Parameter field and map it to a data field in your workflow.

4. You can then use that data field as a form parameter to pass to a future task forms, assuming it will never change.

 

I think the problem is that you're trying to use form parameters like variables.  When events happen at runtime form parameters can't be updated by rules or other logic, so my earlier recommendation to use a hidden field was to circumvent that issue.  I don't know if this has changed in the new version or not.

 

Hope that makes sense!

Reply