| 
																		 The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com! 
	 Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines. 
 | 
	
 | 
  
 
																			
																			 
																			
		
			 | 
		 
			
		 
			 | 
				
					Contact last name lookup based on AccountID and not Account Name  
						Posted: 22 Jun 06 9:37 AM
					 | 
				 
					fiogf49gjkf0d I found the script that restricts the contact lookup to only contacts list for the account chosen in thaccount field.
  PROBLEM:  it brings back all contacts based on account name and not account id, so if there are 2 accounts with the same name and they both have 2 contacts the lookup will bring back 4 contacts after choosing the specific account.  this becomes a mess when you have 14 accounts with the same name....."Mercy Hospital"
  here is the script..........very shot and sweet but I cant figure out what exactly i need to edit to bring back the proper contacts.  Any help???
 
      Global Const ScriptName = "META Ticket  Contact When PopUp"
  sub main '*********************************************************************************************************  ' Description: Limits the Contact lookup to the Account ' Purpose    :  ' Called By  :  Account When Change ' Calls      :  ' Inputs     :  ' Outputs    :  ' Written    : 12/99 mjm ' Updates    : '*********************************************************************************************************  call slx_Specific
  '*********************************************************************************************************  ' place your customization code here '*********************************************************************************************************  end sub 
  sub slx_Specific()
    If UCase ( CurrentViewMode ) = "TRUE" then     Call InsertMode   Else     Call EditMode   End If
    If LogixErrors then  Checkerror
  End Sub
 
  Sub InsertMode
    If Trim ( GetPropertyOf ( "leAccount", "Text" )) <> "" then     setpropertyof "leContact", "LookupRestrictAlways", "True"        setpropertyof "leContact", "LookupRestrictField", "CONTACT:ACCOUNT"     setpropertyof "leContact", "LookupRestrictOp", "="     setpropertyof "leContact", "LookupRestrictValue", getpropertyof ( "leAccount", "Text" )	   Else     setpropertyof "leContact", "LookupRestrictField", "CONTACT:STATUS"     setpropertyof "leContact", "LookupRestrictOp", "="     setpropertyof "leContact", "LookupRestrictValue", "Active"     setpropertyof "leContact", "LookupRestrictAlways", "True"   End If
  End Sub
 
  Sub EditMode
    If Trim ( GetPropertyOf ( "leAccount", "LinkID" )) <> "" then     setpropertyof "leContact", "LookupRestrictAlways", "True"     setpropertyof "leContact", "LookupRestrictField", "CONTACT:ACCOUNT"     setpropertyof "leContact", "LookupRestrictOp", "="     setpropertyof "leContact", "LookupRestrictValue", getpropertyof ( "leAccount", "Text" )   Else     setpropertyof "leContact", "LookupRestrictAlways", "True"     setpropertyof "leContact", "LookupRestrictField", "CONTACT:STATUS"     setpropertyof "leContact", "LookupRestrictOp", "="     setpropertyof "leContact", "LookupRestrictValue", "Active"
    End If
  End sub
 
  Sub CheckError dim I as Integer
  I = Msgbox ( LogixErrorText, 16, ScriptName )
  End Sub
      | 
				 
					 | 
				 
			  | 
		 
			 | 
				
					Re: Contact last name lookup based on AccountID and not Account Name  
						Posted: 22 Jun 06 11:43 AM
					 | 
				 
					fiogf49gjkf0d Just change the two lines with 
  setpropertyof "leContact", "LookupRestrictField", "CONTACT:ACCOUNT"
  to 
  setpropertyof "leContact", "LookupRestrictField", "CONTACT:ACCOUNTID"
  and the 2 lines shortly after those:
  setpropertyof "leContact", "LookupRestrictValue", getpropertyof ( "leAccount", "Text" )
  to 
  setpropertyof "leContact", "LookupRestrictValue", getpropertyof ( "leAccount", "LinkID" )
  I can't test it right now, but that should do the trick. | 
				 
					 | 
				 
			  | 
		 
			 |  | 
		 
			 | 
		 
	 
																			  You can 
																				subscribe to receive a daily forum digest in your 
																					user profile. View the site code 
																					of conduct for posting guidelines. 
																					
 
	
		
			    Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
			 |   
		 | 
		  | 
	 
 
 																					
																					
																		 | 
	  |