Here is the code from ftl file:
<td>
<#assign mainRole =
dispatcher.runSync("getPartyMainRole",
Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId",
partyRow.partyId, "userLogin", userLogin))/>
${mainRole.description?if_exists}
</td>
Here is the code from service definition:
<service name="getPartyMainRole" engine="simple"
location="component://party/script/org/ofbiz/party/party/PartyServices.xml"
invoke="getPartyMainRole">
<description>Get the main role of this party which is a child
of the MAIN_ROLE roletypeId</description>
<attribute name="partyId" type="String" mode="IN" optional="false"/>
<attribute name="roleTypeId" type="String" mode="OUT" optional="true"/>
<attribute name="description" type="String" mode="OUT" optional="true"/>
</service>
Here is the code from Mini Lang:
<simple-method method-name="getPartyMainRole"
short-description="Get the main role of this party which is a
child of the MAIN_ROLE roletypeId">
<entity-and entity-name="PartyRole" list="partyRoles">
<field-map field-name="partyId" from-field="parameters.partyId" />
</entity-and>
<!-- find the role in the list -->
<clear-field field="mainRoleTypeId"/>
<iterate entry="partyRole" list="partyRoles">
<if-empty field="mainRoleTypeId">
<entity-and entity-name="RoleTypeIn3Levels"
list="roleTypeIn3Levels">
<field-map field-name="topRoleTypeId" value="MAIN_ROLE" />
<field-map field-name="lowRoleTypeId"
from-field="partyRole.roleTypeId" />
</entity-and>
<if-not-empty field="roleTypeIn3Levels">
<set field="mainRoleTypeId"
from-field="partyRole.roleTypeId" />
</if-not-empty>
</if-empty>
</iterate>
<if-not-empty field="mainRoleTypeId">
<field-to-result field="mainRoleTypeId" result-name="roleTypeId" />
<entity-one entity-name="RoleType" value-field="roleType">
<field-map field-name="roleTypeId"
from-field="mainRoleTypeId" />
</entity-one>
<field-to-result result-name="description"
field="roleType.description" />
</if-not-empty>
</simple-method>
Please let me me know if you need any help to understand the code.
In short refer RoleTypeIn3Levels entity. :-)
Thanks!
--
Ashish
On Wed, Mar 24, 2010 at 7:15 PM, chris snow <[email protected]> wrote:
> Hi Rishi, how is the main role differentiated from the other roles?
>
> Many thanks,
>
> Chris
>
> On Wed, Mar 24, 2010 at 1:41 PM, Rishi Solanki <[email protected]>wrote:
>
>> Hi,
>> It is coming from RoleType entity in the dropdown.
>> The Party main role as well as any other role is stored in PartyRole like ;
>> BUYER, SALES_REP, CUSTOMER etc.
>>
>> Rishi Solanki
>> Enterprise Software Developer
>> HotWax Media Pvt. Ltd.
>>
>>
>> On Wed, Mar 24, 2010 at 4:53 PM, Christopher Snow <
>> [email protected]> wrote:
>>
>> > In the party find screen, there is a column to show the Party's Main
>> Role.
>> >
>> > Where is the party main role stored?
>> >
>> > Many thanks in advance,
>> >
>> > Chris
>> >
>>
>