Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Lookup field on DocuView form, form goes blank after lookup

(0) ShareShare
ReportReport
Posted on by 180

I have added a new string field to the DocuView form with a lookup (as below). When I open the form I see all the existing data on the form. When I do the lookup it works as expected, however when the lookup returns the DocuView form is wiped of all data. When I exit and return into the DocuView I see the selection made on the lookup. I know I need to do something to "capture" and then return the DocuView but not sure what that is or how to accomplish it. Thanks for any help.


public void lookup()
{
sysTableLookup sysTableLookup;
Query Artquery = new Query();
QueryBuildDataSource qbds;
FormRun callerForm;


//super();
callerForm = element.args().caller();

// Instantiate sysTableLookup object using table which will provide the visible fields
sysTableLookup = SysTableLookup::newParameters(tableNum(ArtCustomerAdvocateV1), this);


// Create the query.
qbds= Artquery.addDataSource(tableNum(ArtCustomerAdvocateV1));

sysTableLookup.parmQuery(Artquery);

// Specify the fields to show in the form.
sysTableLookup.addLookupfield(fieldNum(ArtCustomerAdvocateV1, Name));

// Perform the lookup
sysTableLookup.performFormLookup();

}

  • LBP Profile Picture
    LBP 180 on at
    RE: Lookup field on DocuView form, form goes blank after lookup

    I have added another field which is a simple string entry field. I have tested by changing every other field on the form and the functionality appears fine. As soon as I access and return from the lookup field the DocuView form wipes all data and shows as completely blank. I can exit and reopen the form, then it shows as it should with my lookup selection also updated.

  • Martin Dráb Profile Picture
    Martin Dráb 231,307 Most Valuable Professional on at
    RE: Lookup field on DocuView form, form goes blank after lookup

    Please use Insert > Code (in the rich formatting view) to paste source code. Let me re-post (and simplify) your code:

    public void lookup()
    {
    	Query artQuery = new Query();
    	QueryBuildDataSource qbds = artQuery.addDataSource(tableNum(ArtCustomerAdvocateV1));
    
    	// Instantiate sysTableLookup object using table which will provide the visible fields
    	SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ArtCustomerAdvocateV1), this);
    
    	sysTableLookup.parmQuery(artQuery);
    
    	// Specify the fields to show in the form.
    	sysTableLookup.addLookupField(fieldNum(ArtCustomerAdvocateV1, Name));
    
    	// Perform the lookup
    	sysTableLookup.performFormLookup();
    }

    Nevertheless I don't see anything that could cause such behavior. Are you sure that it's about lookup()? Can't it be caused by some other code, e.g. in modified()?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans