Hexagon Geospatial
MENU

M.App Enterprise

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Frequent Contributor
Posts: 159
Registered: ‎01-14-2018
Accepted Solution

Pass field value from a node to another in M.App Enterprise workflow

Dear all,

 

In M.App Enterprise, I have a workflow having:

a list of table A having field called A_code

a form of table B having a field called B_code

 

The workflow works as the user open the list and choose a record,

it will open the form at which he can draw a new line or edit old line and it will be recorded in table B.

 

The problem is that I want to pass the value of 'A_code' of the choosed row to the form and fill the B_code with that value.

 

Does anyone know how to pass a field from a node to another node although the 2 nodes are refering to different tables?

 

Kind regards

Khaled

Staff
Posts: 1,032
Registered: ‎10-18-2015

Re: Pass field value from a node to another in M.App Enterprise workflow

[ Edited ]

hi Khaled,

 

you can use a session trigger to store the value of the current row in the session and then redirect to the next form. In the form you will use the value from the session as default value.

 

Here is a sample for the row action:

 

IG.trigger({ 
	triggerNames: ['MySessionTrigger'], 
	postForm: false, 
	urlParams: { 
		MyColumn: {ROW.MyColumn}
	}
})
.done(
	function (result) { 
		IG.navigate('NextNode') 
})

Here is the session trigger:

 

<WorkflowTrigger name="MySessionTrigger" type="SessionTrigger" method="action" >
	<Param name="Key" value="TableA.MyColumn"/>
	<Param name="Value" value="{REQUESTCONTEXT.MyColumn}"/>
</WorkflowTrigger>	  

HTH,

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Frequent Contributor
Posts: 159
Registered: ‎01-14-2018

Re: Pass field value from a node to another in M.App Enterprise workflow

Thanks Stefano,

 

I tried to do what you refer but as I am quite new to M.App Enterprise could you list them in steps. 

I don't know where to write that trigger xml and also where to write the row action, there are multiple options that can be choosed as 'javascript' and 'Placeholder' I tried them but nothing happened.

I would be very grateful to you if you list the steps.

 

kind regards

Khaled

Staff
Posts: 1,032
Registered: ‎10-18-2015

Re: Pass field value from a node to another in M.App Enterprise workflow

hi Khaled,

 

you will have:

  1. List:
    1. SessionTrigger: this trigger will store the value of tableA in the session as TableA.A_code (or MyColumn as written in my post)
    2. RowAction in the list using the JS I've put before: this will manually fires the trigger above when the user click on the action
  2. Form:
    1. in the defaultvalue of your B_code you will use TableA.A_code (or MyColumn as written in my post)

 

That's all. Please inspect the session to understand what is happening using the workflow (the session table in the tenant metadata is called mapp_session).

 

Stefano

Stefano Turcato
Presale Engineer
Hexagon Geospatial
Highlighted
Frequent Contributor
Posts: 159
Registered: ‎01-14-2018

Re: Pass field value from a node to another in M.App Enterprise workflow

Much thanks Stefano

Contributor
Posts: 86
Registered: ‎11-29-2015

Re: Pass field value from a node to another in M.App Enterprise workflow

[ Edited ]

Hi Stefano,

 

I know this is quite an old post. However my question is very similar.

The SessionTrigger you have suggested is working perfectly for a rowaction within a list.

 

Now i would like to create a sessionTrigger within a table. Therefore, I need a SQL-Statement to get the desired value. How can I define this?

 

I have tried the following option:

 

1. SQL-Statement within the workflowsettings. Here I get the problem of the urlParams, as the value does not exist within the table..

FS:

<FormAction name="navigate.bakaempfung" label="zur Bekämpfung" editable="true" visible="true" action="SCRIPT[IG.trigger({triggerNames:['B1StandortIDBekaempf'], postForm: false, urlParams:{id_bekaempf:{ROW.id_standort}}}).done(function(result){IG.navigate('20')})]" type="row" />

 

WS:

<WorkflowTrigger name="B1StandortIDBekaempf" method="action" type="SessionTrigger">
<Param name="Key" value="bekaempfung.id_bekaempf" />
<Param name="Value" value="SQL[SELECT id_bekaempfung FROM standort a JOIN befallserfassung b ON a.id_standort=b.fs_standort JOIN bekaempfung c ON b.id_befall=c.fs_befall WHERE id_standort={SESSION.standort.id_standort} AND b.id_befall={ROW.id_befall}]).done(function(result){IG.navigate(30)})]" />
</WorkflowTrigger>

 

 

What's wrong? (solved >> see reply)

Thanks a lot,

Hella

Contributor
Posts: 86
Registered: ‎11-29-2015

Re: Pass field value from a node to another in M.App Enterprise workflow

[ Edited ]

FS:

<FormAction name="navigate.bekaempfung" label="Bekämpfungen" editable="true" visible="true" action="SCRIPT[IG.trigger({triggerNames:['B1StandortIDBefall'], postForm: false, urlParams:{id_befall:{ROW.id_befall}}}).done(function(result){IG.navigate('30')})]" type="row" />

 

WS:

<WorkflowTrigger name="B1StandortIDBefall" method="action" type="SessionTrigger">
<Param name="Key" value="befallserfassung.id_befall" />
<Param name="Value" value="{REQUESTCONTEXT.id_befall}" />
</WorkflowTrigger>
</WorkflowNode>

 

There was a logical problem and it was solved by triggering a different Session.ID

Do you need immediate support?
If you encounter a critical issue and need immediate assistance please submit a Development Ticket through our Development Ticket Portal.