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

Select statement for table PSAProjSchedRole is working in test but not working in Live.

(0) ShareShare
ReportReport
Posted on by 506

Hi all,

In the below code, even the data is in the table projSchedRole.ProjId matches with the data in the projTable.ProjId and projSchedRole.Worker == _worker

projSchedRole is not selecting any record.

Its working on test env. but not working in live. 

Can you anyone help and tell why its not working in live env.

PSAProjSchedRole projSchedRole;

if(event == "RoleStart" || event == "RoleEnd")
    {
        select * from projSchedRole where projSchedRole.ProjId == projTable.ProjId
                                        && projSchedRole.Worker == _worker;
            if(projSchedRole)
            {
                if(projSchedRole && (event == "RoleStart" || event == "RoleEnd"))
                {
                    resourceName = HcmWorker::find(projSchedRole.Worker).name();
                }
            }
    }

Thanks and regards

Siddhant Singh

  • Martin Dráb Profile Picture
    Martin Dráb 231,321 Most Valuable Professional on at
    RE: Select statement for table PSAProjSchedRole is working in test but not working in Live.

    I can think of two explanations:

    1. One or more values are not what you expect (DataAreaId, ProjId, Worker, event).
    2. Or the data in database isn't the same when executing your code (because there are uncommitted changes done in the same transaction).

    (For completeness: I'm not taking Partition into account here, because I assume it's not the current problem.)

    If you believe that everything is correct, then I suggest you get Live data to a development environment and debug code against Live data.

    Compiling the Live environment shouldn't be necessary - that should have been be done when deploying code to Live. If you get into situation when it's needed, then your deployment process doesn't work correctly.

  • Siddhant Singh Profile Picture
    Siddhant Singh 506 on at
    RE: Select statement for table PSAProjSchedRole is working in test but not working in Live.

    Hi Martin,

    Yes I executed both SQL and X code in company context.

    Project Id is also matching in sql. In SQL code with and without dataAreaId the output is same only. 

    select * from PSAPROJSCHEDROLE
     where PSAPROJSCHEDROLE.ProjId = 'ABC-0000**'
       and PSAPROJSCHEDROLE.Worker = 5637******
       and PSAPROJSCHEDROLE.DATAAREAID='ABC'

    pastedimage1596021435494v1.png

    Do by running full CIL will help in this case to remove this defect.

    Thanks and Regards

    Siddhant Singh

  • Martin Dráb Profile Picture
    Martin Dráb 231,321 Most Valuable Professional on at
    RE: Select statement for table PSAProjSchedRole is working in test but not working in Live.

    Can you show us your T-SQL code, please? People often forget to include DataAreaId in relations in T-SQL and then the result may be completely misleading.

    Do you execute both T-SQL and X++ in the company context?

    You said that you're sure that two of the three variables have the right value. What about the project ID?

  • Siddhant Singh Profile Picture
    Siddhant Singh 506 on at
    RE: Select statement for table PSAProjSchedRole is working in test but not working in Live.

    Hi Blue Wang,

    I tried the query in Live SSMS and got the output with this select query but when i am trying this on AX its not returning any value.

    And also my event is coming correct and variable _worker is having right value.

    Can you tell what may be the reason behind it.

    Thanks and regrads

    Siddhant Singh

  • Blue Wang Profile Picture
    Blue Wang on at
    RE: Select statement for table PSAProjSchedRole is working in test but not working in Live.

    HI Siddhant Singh,

    Is the data of Test and Live environment exactly the same?

    You can write a select statement in SSMS to compare whether there is data that meets the conditions in the Live environment

  • Martin Dráb Profile Picture
    Martin Dráb 231,321 Most Valuable Professional on at
    RE: Select statement for table PSAProjSchedRole is working in test but not working in Live.

    First of all, let me format your code and remove duplicate code, so it's easier to read:

    if (event == "RoleStart" || event == "RoleEnd")
    {
    	PSAProjSchedRole projSchedRole;
    
    	select projSchedRole
    		where projSchedRole.ProjId == projTable.ProjId
    		   && projSchedRole.Worker == _worker;
    		   
    	if (projSchedRole)
    	{
    		resourceName = HcmWorker::find(projSchedRole.Worker).name();
    	}
    }

    Unfortunately there isn't much we can tell you, because it all depends on what data you have in the database (for the current company) and values of projTable.ProjId, event and _worker variables.

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,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans