Notifications
Announcements
No record found.
Hi guys,
i have a scenario in position Form
if it is open position i want to below option in display method how to do in x++ give us a example.
1.Position occupied - "Empty"2.New position - "New"3.Old position already assigned - "Reuser" .
thanks.
Hi Riyas,
Can you explain your definition when an open position is new? Is it date based or e.g. when there are no historical position assignments?
What exactly do you mean with "Old position already assigned"? If it is assigned, then it is not an open position, right?
thanks for your replay sir,
yes! i want to display method and just a return all of hardcore value.
Hi Riyas
You have stated a requirement, not a problem. Please expand.
If you are struggling to write and use a display method - just google "x++ display method". And then if you are struggling with the logic in the display method, you'll need to provide some more information. Table and field names please
thanks for your replay pete,
i want to in the display method if it a new position i need it return "new"
then if it old position return "reuser" and Position occupied "Empty" so that i wrote a small code
but still i'm confusing below my code.
public display Description getPosition() { HcmPositionRecId _positionRecid; HcmPositionWorkerAssignment hcmPositionWorkerAssignment; HcmPositionDetail hcmPositionDetail; HcmJob hcmJob; if(_positionRecid) { // i was wondering how to here } return "Empty" "New" "Reuser"; }
So I can't reconcile my knowledge of HR with your requirement. So let's discuss the table structure first (my functional knowledge is not great, so take it with a pinch of salt):
From the above: 1) It is a long jump to define a position as "New". Maybe the requirement is to determine if a worker has been assigned to the position? 2) "Empty" is straight forward 3) I do not understand "reuser". And I also don't understand what the connection is between an "old position" and "reuser".
Then from a technical point of view:
This method should not be on the form. It should be on the table. Which one exactly I do not know. What form are you extending?
You'll have to try again with explaining the requirement.
So what I think you want is an indication for a position:
Then I'd check if there is existing logic to do this. If there is none, then you should create an enumeration for this purpose.
It should be a display method on HcmPositionDetail in my opinion. Something in this direction:
[ExtensionOf(tableStr(HcmPositionDetail))] final class HcmPositionDetailXYZ_Extension { [SysClientCacheDataMethod] display XYZPositionState positionStateXYZ() { XYZPositionState positionState; HcmPositionWorkerAssignment positionWorkerAssignment; //check if there is a current assignment select firstonly RecId from positionWorkerAssignement where positionWorkerAssignment.Position == this.Position; if (positionWorkerAssignment.RecId) { positionState = XYZPositionState::Assigned; } else { //check if an assignment has ever been made select firstonly validtimestate(DateTimeUtil::minValue(),DateTimeUtil::utcNow()) RecId from positionWorkerAssignment where positionWorkerAssignment.Position == this.Position; positionState = positionWorkerAssignment.RecId ? XYZPositionState::Empty : XYZPositionState::New; } return positionState; } }
I am sure that most of the code I wrote there can be replaced by existing MS methods.
Good luck
thanks for your valuable answer pete.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader