Just hoping there's a easy way to pull that drop down on the orders module on the orders detail tab labeled authorizing provider that contains all the users. I need to mirror that on a custom orders form so users can select it off the form to keep them from going into the orders module if they need to do so.
Any ideas are greatly appreciated, thanks in advance!
Hi Adam,
I don't think you can get direct access to that drop-down, but you could probably code something up in MEL/VFE: (1) create a drop-down list with dynamic choice list; (2) set your drop-down list MEL Expression to a document variable; (3) update this document variable using a watcher expression. The code below (or something similar) might give you what you're looking for.
{DOCUMENT.USER_LIST}
{! getUserDropDown()}
! fn getUserDropDown()
{
local r = ""
local x = getfield(GET_USER_LIST("LOCATION_NAME", "", "delimited"), "|", "")
local z
for y = 1, y <= size(x), y = y + 1 do
z = getfield(x, "^", "")
if r <> "" then r = r + "," endif
r = r + z[2]
endfor
DOCUMENT.USER_LIST = r
}
I may have enter that in wrong but when I click the arrow for my drop down centricity crashes.
Very possible...I didn't do any error checks on that code so something might be off. That was just to give a general idea of what you could do.
Thank you! I was headed down the path of GET_USER_LIST this will help.
So i'm using this:
{!
gProviderList = fnBuildProviderList(GET_USER_LIST("PHYSICIA","","delimited"))
}
{! gProviderList}
{! fn fnBuildProviderList(strList)
{
local retStr = ""
local strTemp = ""
local strBuf = ""
local i
strTemp = getfield(strList,"|","")
for i = 1, i <= size(strTemp), i = i + 1 do
strTemp[i] = getfield(strTemp[i],"^","")
if strTemp[i][2] <> "" then
strBuf = ReplaceStr(strTemp[i][2],",","\,")
if retStr <> "" then
retStr = retStr + "," + strBuf
else
retStr = strBuf
endif
else ""
endif
endfor
return retStr
}
}
Would there be a reason the list that returns isn't in alphabetical order?
I'm guessing that the GET_USER_LIST function isn't setup to return in any particular order...it is probably based on the order that users were entered into the system. Try this...in your for loop, instead of building a comma-delimited string, build an array. Once you're through your loop, send the array through the SORT function, and when it is returned, use another for loop to break it out into the final comma-separated list.
Thanks again, unless I did it wrong (which is always a high chance) it somewhat sorted really quite strange. I'll have to adjust it some more and see what I get. I actually thing it's sorting by User ID.
If its sorting by user ID, you could try building your array in the way you want it sorted. For example,
arrayElement1 = "Haddix;Craig;chaddix"
arrayElement2 = "Daniel;Adam;adaniel"
That way, you're forcing the sort to go last name/first name, instead of by User ID. Once you get the results back, then you can use a getfield/for loop combo to extract what you want for your drop-down list.
Would a array element be per user? Or can the string be placed there?
Yes, in that example, each arrayElement is a user. In your FOR loop, instead of writing to a string, it would be something like insert(arrayName, size(arrayName) + 1, arrayOfUsers[2] + ";"+arrayOfUsers[1]).
In this case:
1. arrayName is what you are (eventually) sending to the sort function
2. arrayOfUsers is the array that you got when you called GET_USER_LIST(). I put element 2 of arrayOfUsers first because this is the SearchName element.