CoreBOSBB
Special Business Map for duplicates? - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+--- Thread: Special Business Map for duplicates? (/showthread.php?tid=483)

Pages: 1 2


Special Business Map for duplicates? - Guido1982 - 11-04-2016

Is there a special business map for duplicates? I'm being asked to handle the duplication of salesorders in a special way and I'd rather not hack...


RE: Special Business Map for duplicates? - omarllorens - 11-04-2016

For duplicates , you can try creating a map with the name SalesOrder2SalesOrder and select Mapping type.


RE: Special Business Map for duplicates? - Guido1982 - 11-04-2016

Cool. Could I also collect a field from a related module this way? So when a salesorder is duplicated, collect the payment condition field from the account in stead of taking the source-SO payment condition?


RE: Special Business Map for duplicates? - omarllorens - 11-04-2016

cbMaps support the workflow expressions, so you can use the same syntax to get fields values when you create an email task and select fields to compile the email.

For example from if need the Account Industry field from SalesOrder module, the syntax is: $(account_id : (Accounts) industry)

You can try the same but with you custom field. The easy way is trying to create an email task to SalesOrder module to obtain the expression that you need.

Try it, and tell us if work, please.


RE: Special Business Map for duplicates? - Guido1982 - 11-04-2016

I don't have much experience with workflow syntax but I'll try some thingsd and get back here. By the way, how do I contribute my Business Maps to the store?


RE: Special Business Map for duplicates? - joebordes - 11-04-2016

A small trick: I open a "send email" workflow task against the same module, then go to the body of the email and select the value I want from the picklist. Then you just have to copy and paste.

Either follow the instructions on the documentation project: https://github.com/tsolucio/coreBOSDocumentation

or just send it to us and we will upload it. As you prefer.


RE: Special Business Map for duplicates? - Guido1982 - 11-04-2016

Good tip, thanks.. I'll fork the documentation as soon as I can.


RE: Special Business Map for duplicates? - Guido1982 - 11-07-2016

I've setup a Business Map, but so far it's not working yet. The Business map name is "SalesOrder2SalesOrder", the target module is SalesOrder and the map is as follows:

Code:
<map>
<originmodule>
 <originid>22</originid>
 <originname>SalesOrder</originname>
</originmodule>
<targetmodule>
 <targetid>22</targetid>
 <targetname>SalesOrder</targetname>
</targetmodule>
<fields>
 <field>
   <fieldname>exact_payment_cond</fieldname>
   <fieldID>933</fieldID>
   <Orgfields>
     <Orgfield>
       <OrgfieldName>$(account_id : (Accounts) exact_payment_cond)</OrgfieldName>
       <OrgfieldID>932</OrgfieldID>
     </Orgfield>
    </Orgfields>
 </field>
</fields>
</map>

What am I doing wrong here?

It seems I've some error in my workflow expression. When I add this field to the Business Map:

Code:
<field>
    <fieldname>ship_street</fieldname>
    <Orgfields>
      <Orgfield>
        <OrgfieldName>$(account_id : (Accounts) ship_street)</OrgfieldName>
      </Orgfield>
     </Orgfields>
  </field>

It clears out the ship street on duplicating, rather than filling out the address from the account.


RE: Special Business Map for duplicates? - joebordes - 11-07-2016

The <OrgfieldID> directive is important:

<OrgfieldID>CONST</OrgfieldID>
means that the value is used exactly as you put it

<OrgfieldID>FIELD</OrgfieldID>
means that it has to processed as a field, either of the module or of one of it's directly related one (this is what you need)

<OrgfieldID>EXPRESSION</OrgfieldID>
the value must be passed through the workflow expression parser/engine

<OrgfieldID>TEMPLATE</OrgfieldID>
It is like the email body with static parts and variables, it is a simple way to avoid having to concatenate all the strings and variables


RE: Special Business Map for duplicates? - Guido1982 - 11-07-2016

Ah, makes sense. I'll try and get back to you.

Works like a charm. Thanks!