(ref: WorkdayReference | undefined)
| 661 | * Handles the nested ID structure that Workday returns. |
| 662 | */ |
| 663 | export function extractRefId(ref: WorkdayReference | undefined): string | null { |
| 664 | if (!ref) return null |
| 665 | const id = ref.ID |
| 666 | if (Array.isArray(id)) { |
| 667 | return id[0]?.$value ?? id[0]?._ ?? null |
| 668 | } |
| 669 | if (id && typeof id === 'object') { |
| 670 | return id.$value ?? id._ ?? null |
| 671 | } |
| 672 | return null |
| 673 | } |