skearton Posted July 18, 2011 Posted July 18, 2011 Hi Gurus! I spent today figuring how to get a picker window locked down. It is our product picker window, and now the user must select a button on it to do something or they can't close the window. Fine and dandy with selecting a product because we have already specified the find request for the customer products. Now, I'm trying to implement the same thing in the quote contact picker. Before, the user could only select one contact at a time to add to the project contacts table. I wanted to give them the ability to add multiple contacts at a time. The rub with this is we rely on the user to do a find for the contact or customer name first to narrow down the results. Of course now I can't do a find when I pause the script indefinitely, locking it down so that they make a decision. Not sure of an elegant way to script this. Don't really want to have 2 separate popup windows; one to do the find, and then the other to display the results of the find and that lets the user select the individual contacts to add to the quote. How have you folks handled this scenario? Here are my scripts in relation to the contact picker: Button Script Parameter for script directly below is "Add Contact". Go Customer Search from Quotes Allow User Abort [ Off ] Set Error Capture [ On ] # Set Variable [ $$ProjectID; Value:Quote::_kf_ProjectID ] # Freeze Window # New Window [ Name: Get (ScriptParameter);Height: 600; Width: 700; Top: 100; Left: 100 ] Go to Layout [ “Contact Picker” (CONTACT) ] Show/Hide Status Area [ Hide ] Clear [ CONTACT::_kg_ContactKeyHolder ] # [ Select ] Commit Records/Requests # Enter Find Mode [ ] Set Error Capture [ On ] Go to Field [ CONTACT::NameFullFirstLast ] [ Select/perform ] # Pause/Resume Script [ Indefinitely ] # # If [ Get (ScriptParameter) = "Add Contact" ] Perform Script [ “Add Contacts to Project Quote” ] End If # Exit Script [ ] Once the user is on the Contact Picker Layout they have various buttons that call this script below with different parameters: Select Contact Allow User Abort [ Off ] Set Error Capture [ On ] # # show selected only If [ Get (ScriptParameter) = "show selected only" ] Go to Related Record [ From table: “contact_CONTACT__highlighted”; Using layout: <Current Layout> ] [ Show only related records ] End If # # deselect all If [ Get (ScriptParameter) = "deselect all" ] Set Field [ CONTACT::_kg_ContactKeyHolder; "" ] End If # # cancel If [ Get (ScriptParameter) = "cancel" ] Close Window [ Current Window ] Exit Script [ ] End If # # select or deselect If [ Get (ScriptParameter) = "select" ] Set Field [ CONTACT::_kg_ContactKeyHolder; Case ( IsEmpty ( FilterValues ( CONTACT::__kp_ContactID ; CONTACT::_kg_ContactKeyHolder ) ) ; List ( CONTACT::_kg_ContactKeyHolder ; CONTACT::__kp_ContactID ) ; Let ( excl = Substitute ( ¶ & CONTACT::_kg_ContactKeyHolder & ¶ ; ¶ & CONTACT::__kp_ContactID & ¶ ; ¶ ) ; Middle ( excl ; 2 ; Length ( excl ) - 2 ) ) )] Commit Records/Requests Exit Script [ ] End If # When the user is on the Contact Picker Layout and they click on the "Add" button it is simply a "resume script" step, which then resumes the original script "Go Customer Search from Quotes". The script called "Add Contacts to Project Quote" reads like this: # capture selected contact IDs Set Variable [ $ContactIDs; Value:CONTACT::_kg_ContactKeyHolder ] Go to Layout [ “project_PROJECTCONTACTS” (project_PROJECTCONTACTS) ] # loop through values and create project contacts records Loop Set Variable [ $i; Value:$i + 1 ] Exit Loop If [ $i > ValueCount ( $ContactIDs) ] New Record/Request Set Field [ project_PROJECTCONTACTS::_kf_ProjectID; $$ProjectID ] Set Field [ project_PROJECTCONTACTS::_kf_ContactID; GetValue ( $ContactIDs ; $i ) ] End Loop Close Window [ Current Window ] Commit Records/Requests Refresh Window
bcooney Posted July 19, 2011 Posted July 19, 2011 This popup select demo that I've posted here many times includes a script trigger find and a new button. I don't think it allows for multiple selections while in the popup, but that's easy to modify (as you did, by populating a global multikey). If I have time today, I'll do a revision that allows for multiple selections.
Recommended Posts
This topic is 4876 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now