I want to display the Created by user but instead of the user id I want to display the user name.
I want the column to be filter-able and so do not want to use display method but to rely on the form datasource.
The form is the Item requirements form, ProjSalesItemReq.
In the AOT, I've added the datasources, DirPersonUser and DirPartyTable and dynamically linked them to the form datasource using their init() methods, as follows:
public void init() { #DEFINE.DataSourceDirPerson('DirPersonUser') QueryBuildDataSource qbds; super(); qbds = this.query().dataSourceName(#DataSourceDirPerson); qbds.clearLinks(); qbds.addLink(fieldNum(SalesLine,CreatedBy),fieldNum(DirPersonUser,User)); } public void init() { #DEFINE.DataSourceDirPartyTable('DirPartyTable') QueryBuildDataSource qbds; super(); qbds = this.query().dataSourceName(#DataSourceDirPartyTable); qbds.clearLinks(); qbds.addLink(fieldNum(DirPersonUser,PersonParty),fieldNum(DirPartyTable,RecId)); }
However, when I create an Item requirement by clicking on the New button I get this dialog "Select a record type to create":
There must be some way to prevent this from happening but allow the User name column to be displayed and filterable?
For info, I have set the new datasources as follows:
I have tried setting the JoinSources to Passive and Delayed but then the form does not load and I get errors saying these are not part of the parent datasource.
*This post is locked for comments
I have the same question (0)I've managed to solve this one partially.
This forum post has a closing comment which sent on me the right track.
I created a new view UserNames, joining the 2 tables DirPersonUser and DirPartyTable exposing the Name and User fields. Then added this as a form datasource joining to SalesLine as an inner join and overrode the init() method of the view's datasource as follows:-
public void init() { #DEFINE.DataSourceUserNames('UserNames') QueryBuildDataSource qbds; super(); qbds = this.query().dataSourceName(#DataSourceUserNames); qbds.clearLinks(); qbds.addLink(fieldNum(SalesLine,CreatedBy),fieldNum(UserNames,User)); }
However, I cannot seem to programatically refresh the form after a new record is saved so that the new user's name is automatically displayed.