Tuesday, February 20, 2024

How to retrieve the value from array or list in logic app

 

As per my requirement, I need to trigger third-party API. Upon a successful response, the API provides an array containing the Account ID. I have to retrieve this value without utilizing a for-each loop.

 I have successfully met this requirement using the following approach. 


Below is the JSON format:

"OrderLines": [
    {
	"line": "1",
	"orderedAccount": {
	    "Reference": {
		"AccountID": "ABC1234"
		}
	    }
    }
]

I have used the Below expression:

"body('HTTP')?['OrderLines']?[0]?['orderedAccount']?['Reference']?['AccountID']"


"OrderLines": [
    {
	"Reference": {
	    "AccountID": "ABC1234"
	   }
    },
    {
	"Reference": {
	    "AccountID": "ABC1235"
	    }
    }
],

I have used the Below expression:

"body('HTTP')?['OrderLines']?[0]?['Reference']?['AccountID']"

Output: ABC1234.


Keep Daxing!!














Friday, February 16, 2024

Get worker current company using x++

 Get worker current company using x++.




    HcmWorker               hcmWorker;
    HcmEmployment           hcmEmployment;     utcdatetime             now = DateTimeUtil::utcNow();     CompanyInfo             companyInfo; 

    select ValidTimeState(now) hcmEmployment         join hcmWorker
            where hcmWorker.RecId == hcmEmployment.Worker
            && hcmWorker.PersonnelNumber == ''
        join companyInfo where companyInfo.RecId == hcmEmployment.LegalEntity;


Keep Daxing!!