Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Field Map tries to transport a webservice ID
#1
I am creating a workflow that creates an entity of recordtype A (custom module I wrote) when an asset is created for the first time. I filled out the mandatory fields in the workflow screen and have also setup a Field Business Map that more closely determines which fields should be transported from the Asset to the record to be created FROM that Asset.

Now when creating the asset I get the 'Sorry! Attempt to access restricted file' message. I turned on debugging and found out that the workflow tries to create the 'recordtype A', it tries to insert into the entitytable some values of which one is in webservice format. This is a SalesOrder ID that I get from the Asset through a FIELD directive in the Business Map.

The field directive looks like this
Code:
   <field>
     <fieldname>related_so_id</fieldname>
     <Orgfields>
       <Orgfield>
         <OrgfieldName>assets_related_soid</OrgfieldName> {Field I created on Assets}
         <OrgfieldID>FIELD</OrgfieldID>
       </Orgfield>
     </Orgfields>
   </field>
I tried setting it to:
Code:
   <field>
     <fieldname>related_so_id</fieldname>
     <Orgfields>
       <Orgfield>
         <OrgfieldName>$(assets_related_soid : (SalesOrder) salesorderid)</OrgfieldName>
         <OrgfieldID>TEMPLATE</OrgfieldID>
       </Orgfield>
     </Orgfields>
   </field>
Which managed to create the new record but still failed to transport the salesorderid from the Asset to the new record.


Beware
This BusinessMap does work (with the first code example). When I manually create a new 'record A' type from the asset, the map does its job, also correctly in transporting the salesorder ID from the Asset to the new record.
Reply
#2
UPDATE
I managed to get something that I want in the sense that I can create an automatically generated record of module B with the values that I want, by leaving the salesorder field out of the businessmap and setting it in the workflow configuration screen. This, however prevents me from being able to use the businessmap when I do a 'normal' create B from A, or at least, use the salesorder field in the businessmap.
Reply
#3
the correct syntax to get the record ID is:

$(assets_related_soid : (SalesOrder) record_id)

https://github.com/tsolucio/coreBOSTests/blob/master/modules/com_vtiger_workflow/expression_engine/VTExpressionEvaluaterTest.php#L574

try that and confirm
Joe
TSolucio
Reply
#4
Did the trick, as soon as I saw it I remembered that was the special ID syntax...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)