How to determine Slot ID in JEXL DB publishing bindings

I am DB publishing to a table that requires item.ContentID and for a given slot, the slot.ContentIDs. I also need to write to the table the SlotID for the given slot.

Ok with getting the slot contentIDs via:

$slotContents = $user.psoSlotTools.getSlotContents($sys.assemblyItem,“ppStName”, null);
and …
$slotContentIDs = $user.psoSlotTools.getSlotPropertyValues($slotContents,“sys_contentid”);

At the moment I am having to hard code the SlotID that is getting written to the DB. However as we move from dev to test to live RX installs this ID may vary, so would prefer to have a JEXL expression to derive it.

Has anyone got an idea how I can achieve this. Ta.

Managed to get a solution to this ouside of forum, thanks to an RX expert.

$stName = “ppStName”;
$stID = 0;
$lstSt = $rx.db.get("", “select SLOTID from RXSLOTTYPE where SLOTNAME=’” + $stName + “’”);
if (!empty($lstSt)) { $stID = $lstSt[0][“SLOTID”]; }
$stID;

Not bad. I would have done something like:


#set($slotid = $sys.asm.findSlotByName("ppStName").getGUID().getUUID())##

but to each their own as the database call would be a lot faster…