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
    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
    232,917 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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,145 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,917 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans