Need help with Smartlookup

ATTENTION: This forum is no longer active. Please navigate to our new support site at
Viewing 1 posts (of 1 total)
Richard Howard
User - Author
Post count: 31

I'm using the following script to retreive a guid :

  1. Function ScriptedField
  2.    dim pid
  3. 	dim id
  4. 	pid = SmartLookup("contact","contactid","new_actcontactid='@@ORG:CONTACTID@@'",True)
  5. 	id = SmartLookup("account","accountid","primarycontactid=pid",True)
  6. 	if id <> "" then ScriptedField="MSCRMLOOKUP,account," & id
  7. End Function

I am getting the following error msg. I am not experienced at scripting in starfish, so any help is appreciated.

Result: MSCRMLOOKUP,account,SmartLookup Error:
<description> An exception System.FormatException was thrown while trying to convert input value '[pid]' to attribute 'account.primarycontactid'. Expected type of attribute value: System.Guid. Exception raised: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).</description>
</error> - System.Web.Services.Protocols.SoapException: Server was unable to process request.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.Crm.SdkTypeProxy.CrmService.Execute(Request Request)
at StarfishCommon.VBScriptSupport.ExecQueryMSCrm(String entity, CrmService serv)
at StarfishCommon.VBScriptSupport.SmartLookup(String l_table, String l_field, String l_filter, Boolean l_cache, String order_by, String RunAgainst)

Comments (1)

Aron Hoekstra's picture Aron Hoekstra
Post count: 2

Very close there, just looks like you have a small mistake in your code..

this line:

  1. id = SmartLookup("account","accountid","primarycontactid=pid",True)

Should look like this:

  1. id = SmartLookup("account","accountid","primarycontactid='" & pid & "'",True)

I know, it's a bit confusing the difference between Starfish variables and VBScript variables... you're using both in this script.

Log in to post comments
Viewing 1 posts (of 1 total)

Forum Login

Login or sign up for our forums to connect to the user community.


You must log in to post.

Not a Member? Register.