I am fairly new to modx. I have tried to find a solution for myself the past few days and I think that I am missing something.
I created two lists;
1) Debtors
2) User
I use migx to manage the debtors and the users. I like to have a list of users within a debtor (which is some kind of group).
I managed to get that working. I have a grid and can Add and Edit users. I created a snippet getUserlist. No problems there. It all seems to work.
I want to extend the logic with that Snippet. I only want to show the users which are not assigned (for example). And of course the current user id.
I tried everything; @CHUNK binding, Input Option Values with @EVAL binding, an InputTV. Even a field with Description_is_code.
It seemed so easy. Entering the following statement in "Input Option Values" in the tab "Input Options" .
@EVAL return $modx->runSnippet('getUserlist',array("debtorid" => "[[+debtor_id]]","currentuser" => "[[+modx_user_id]]"));
(modx_user_id and debtor_id are fields in the database/xPDO-class)
If I use fixed values (like $modx->runSnippet('getUserlist',array("debtorid" => "2"....) it's Ok. But the placeholders (like [[+debtor_id]]) are not replaced.
I tried @EVAL return $modx->runSnippet('getUserlist',array("debtorid" => "@CODE [[+debtor_id]]","currentuser" => "[[+modx_user_id]]"));
No luck there.
This almost seemed to work. On the tab "Field":
Description_is_code=YES
Description:
[[!getUserlist?
&debtorid=`[[+debtor_id]]`
¤tid=`[[+modx_user_id]]`
]]
But then I only get a text and no formelement (screenshot).
I looked at
https://forums.modx.com/thread/86375/creating-dynamic-listbox-tv-with-help-of-migx but this was about getResources and I do not how this work on custom tables.
I also looked at
https://forums.modx.com/thread/90099/migxdb-passing-record-property-to-input-option but the solution looks a little bit overwhelming.
My question is: "Is it possible to access the current “object” with placeholders or API-calls within something like this in migx??"
Example:
@EVAL return $modx->runSnippet('getUserlist',array("debtorid" => "[[+debtor_id]]","currentuser" => "[[+modx_user_id]]"));
Thanks for you help. By the way; I am using modx revo 2.2.14-pl and migx 2.81.