AlinPaul8806
AlinPaul8806

Reputation: 417

EDT value not updating IN label X++

In the following chunk of code I have a label described as following:

"Today is your birthday %1!  Company x wishes that all your dreams come true!"

And the next piece of code:

public void init()  
{   
       UserId  curUser  = curUserId();  
       SysCompanyUserInfo sysCompanyUserInfo;   
       VendAccount emplName = SysCompanyUserInfo.VendAccount;
       super();    
       if (curUser == SysCompanyUserInfo.UserId)    
       {        
            GreetingMessage.text(strfmt("@NET4183", emplName));      
            pause;    
       } 
 }

The problem is that the emplName does not update within the label itself. Any idea why? Thank you!

Upvotes: 3

Views: 96

Answers (1)

Jonathan Bravetti
Jonathan Bravetti

Reputation: 2238

I think the problem is in sysCompanyUserInfo you never select a record for this table.

You need this (or other select * from sysCompanyUserInfo where...):

SysCompanyUserInfo sysCompanyUserInfo = SysCompanyUserInfo::find(curUserId()); 

Try this:

public void init(){   

       UserId  curUser  = curUserId();  
       SysCompanyUserInfo sysCompanyUserInfo = SysCompanyUserInfo::find(curUserId()); 
       VendAccount emplName = SysCompanyUserInfo.VendAccount;

       super();    

       if(curUser == SysCompanyUserInfo.UserId){        
            GreetingMessage.text(strfmt("@NET4183", emplName));      
            pause;    
       } 
 }

Upvotes: 4

Related Questions