This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Add an extra field to 'Workflow voting Dialog'

ransok - Monday, July 7, 2014 5:01 AM:

 

Hi,

I am trying to add an extra field (Text Field) to 'Workflow voting Dialog' and show the same in 'Workflow Process  History Report'.

Editing 'InBasket-NoteDialog.aspx' which is under ../Client/scripts/InBasket.

I added an extra property(name:min_re Data type : Integer ) to 'Activity Assignment' Item type  and added  row in 'InBasket-NoteDialog.aspx' like the below:

<td align="right">
    <br>
     <b aras_ui_resource_key="inbasketvd.min_re"></b>&nbsp;<br>
     </td>
    <td colspan="3" class="logicalSubSection2">
   <textarea name="Comments2" rows="2" cols="80" wrap="on"></textarea>
   </td>
  </tr>

When I open the Voting dialog it was showing the new field along with an error 'Resource with key inbasketvd.min_re is not found'

Then I added this line <resource key="inbasketvd.min_re" value="Minimum"/> to ui_resource.xml which is under ../Client/xml.  Now there is no error. I can see the field.

Is this the correct way of adding a new resource_key?


Now I want to display the value entered in the new field while completing the workflow activity in 'Workflow Process History Report'.

I did the following changes:

1. Edited 'Workflow History Report' method which is attached to the Report.

     added the newly created property name to the Query in the method:

...........................
<Item type="Activity Assignment" action="get" select="closed_by, closed_on, comments, min_re, path, related_id(name)" >'........................

2. Edited Report Query on the Report and added the new property name.

3. Added a new column in the stylesheet. I added the following line after 'Comments' column.

<td style="font-family:helvetica; font-size:8pt; padding:2px;font-weight:bold; ">Comments</td>
<td style="font-family:helvetica; font-size:8pt; padding:2px;font-weight:bold; ">Minimum</td>

Added this after xsl of 'Comments'

<td style="font-family:helvetica; font-size:8pt; padding:2px;">
          <xsl:value-of select="comments"></xsl:value-of>
         </td>

<td style="font-family:helvetica; font-size:8pt; padding:2px;">
          <xsl:value-of select="min_re"></xsl:value-of>
         </td>

 

But I can't see the values entered in the new field on Activity dialog in the report. Did I miss anything?

Am I need to  do anything else for adding resource_key?

 

Please help me

Found that min_re's value not being stored in database, showing as NULL. How to solve this? How to make the newly added field's value to be stored in database?

 

 



DavidSpackman - Tuesday, July 8, 2014 10:50 AM:

HI Ransok, 

 

I haven't done this before, 

When you check the function completeActivity(mode) in InBasket-VoteDialog.aspx. There is an Aras action called 'EvaluateActivity'.

I think you would need to modify this function to add your example input, however I could not find this method to edit.

 

Hopefully it leads you in the right direction though.

 

Dave



ransok - Wednesday, July 9, 2014 2:40 AM:

Thank you David,

Unable to find out 'EvaluateActivity' function. There is a Server Method added in Activity Assignment Itemtype with OnAfterAdd Event. Is this saving data into database? 

I am trying in the following way:

From function completeActivity(mode) I am  calling a server Method to update the Activity Assignment row in database.

1. Added the below two lines before top.window.close(); in function completeActivity(mode)

var serverBody = "<MyAssID_>"+MyAssID+"</MyAssID_><Minimum_>"+this.Minimum.value+"</Minimum_>";
var edit_result = top.aras.applyMethod("Edit-ActivityAssignments",serverBody);

Server Method Code: C#

Innovator inn = this.getInnovator();

string ass_id = this.getProperty("MyAssID_");
string min = this.getProperty("Minimum_","");
//return inn.newError(ass_id);
Item ActAss = inn.newItem("Activity Assignment","get");
     ActAss.setAttribute("where","[ACTIVITY_ASSIGNMENT].id = '"+ass_id+"'");
     Item Res = ActAss.apply();
     //return inn.newError("Count::"+Res.getItemCount());
     if(Res.getItemCount()!=0)
     {
         Res.setAction("edit");
         Res.setProperty("min_re",min);
         Item FinalRes = Res.apply();
         }

return this;

This is updating the row in database correctly and I am able to see the new field's(min_re) value on the report as well.

But I don't know which is going wrong, it is updating the next Activity Assignment also by adding the same value of the before previous Assignment's min_re to the new Activity Assignment. Like the below:

Here the report is displaying '2' for the Activity for which value is not entered yet. Value in database is updated with the value of before previous Activity'.

Now if I vote and enter min_re's value as 5, I can see the correct value on Report but the Next Activity Assignment is getting '3' (which will become the value of before previous for the new Activity Assignment's min_re) immediately.

Why is this happening?




DavidSpackman - Wednesday, July 9, 2014 11:17 PM:

Hi Ransok,

Repeat activities are cloned from the previous activity.

If you view the activity item type in SQL it might help

----------------------------------------

SELECT

DCO.ITEM_NUMBER,

A.NAME, 

A.ID,

A.[STATE],

A.CLONED_AS,

innovator.ConvertToLocal(A.CREATED_ON,DEFAULT) CREATED_ON,

innovator.ConvertToLocal(A.ACTIVE_DATE,DEFAULT) ACTIVE_DATE,

innovator.ConvertToLocal(A.CLOSED_DATE,DEFAULT) CLOSED_DATE

FROM   

innovator.EXPRESS_DCO AS DCO

INNER JOIN innovator.workflow AS WF ON DCO.id = WF.source_id

INNER JOIN innovator.workflow_process AS WFP ON WF.related_id = WFP.id

INNER JOIN innovator.workflow_process_activity AS WPA ON WFP.id = WPA.source_id

INNER JOIN innovator.activity AS A ON WPA.related_id = A.id 

--INNER JOIN innovator.activity_assignment AS AAS ON A.id = AAS.source_id

WHERE

DCO.ITEM_NUMBER = 'DCO-00001058'

ORDER BY

A.[STATE],

A.ACTIVE_DATE

-----------------------------------------

 

You can use an on_active method on the 'initial review' activity in your workflow to check and delete the min_re value

 

 



ransok - Friday, July 11, 2014 3:43 AM:

Thank you so much David, it is working now. I added the following lines with OnActivate Event.

Innovator inn = this.getInnovator();
Item ActAss = inn.newItem("Activity Assignment","get");
     ActAss.setAttribute("where","[ACTIVITY_ASSIGNMENT].source_id = '"+this.getID()+"' ");
     Item ResAss = ActAss.apply(); 
     //return inn.newError("count: "+ResAss.getItemCount());
     for(int a=0;a<ResAss.getItemCount();a++)
     {
     ResAss.getItemByIndex(a).setAction("edit");
     ResAss.getItemByIndex(a).setProperty("min_re","");
     Item Res = ResAss.getItemByIndex(a).apply();
     }
return this;