MD
Fri Mar 28 09:10:03 CDT 2008
Pat,
You could query the CRM Account via a CRM web service, using the CustomerId
GUID as your filter. I haven't tested this, but the following code might work
(placed in the CustomerId OnChange event):
var AccountId = crmForm.all.customerid.DataValue;
var xml = "" + "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"
http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"
http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"
http://www.w3.org/2001/XMLSchema\">" +
" <soap:Body>" +
" <query xmlns:q1=\"
http://schemas.microsoft.com/crm/2006/Query\"
xsi:type=\"q1:QueryExpression\"
xmlns=\"
http://schemas.microsoft.com/crm/2006/WebServices\">" +
" <q1:EntityName>account</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>creditonhold</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1:Distinct>false</q1:Distinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>"+
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>accountid</q1:AttributeName>" +
" <q1:Operator>Equal</q1:Operator>" +
" <q1:Values>" +
" <q1:Value xsi:type=\"xsd:string\">" + AccountId + " </q1:Value>" +
" </q1:Values>"+
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
// Send the XML
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2006/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","
http://schemas.microsoft.com/crm/2006/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
// Set response to variables
var xmlResp = xmlHttpRequest.responseXML;
var getVal = xmlResp.selectSingleNode("//BusinessEntity");
// Get the Value
var onCredHold = getVal.selectSingleNode("creditonhold").text;
if(onCredHold == true)
{
alert("This Customer is on Credit Hold!")
}
--
MD
"Pat Horridge" wrote:
> I was hoping to move upto CRM 4.0 as we've only had CRM 3 for 6 months and
> I'd assuemd under assurance we could upgrade easily but I now here we're
> looking at 500 UKP per user for license upgrades so that makes it too
> costly.
>
> That's the issue I don't have a way to get the credit limit info.
>
> Currently on an oppertunity (we call them bookings and form our Jobsheets
> for work) when the account is selected as the potential customer you then
> have to click into that account name and check the credit info.
> I expected it to be possible to do that from the oppertunity form as an
> onchaneg event and then pop upm an alert if the account was on hold or the
> value of the opertunity exceeded the credit limit.
> I'd assumed that as the account was known from the customerid field I could
> somehow access the other attributes of the account for that customer.
> I'm sure it's possible with complex code but it seemed the sort of function
> MS would have included as useful.
>
> "Kamal" <khitari@NOSPAMhotmail.com> wrote in message
> news:OTrjv70jIHA.1184@TK2MSFTNGP04.phx.gbl...
> > i'm not sure but in crm 3.0 the above comment applies but if you are in
> > crm 4.0 then all you need is to create relatioships and map fields between
> > the two entities.
> >
> > How are you getting the credit limit from account?
> >
> > --
> >
> > Kamal Hitari
> > MBSS, MCNPS, MCTS
> > 2B.net Ltd
> >
http://kamalhitari.blogspot.com
> >
> >
> > Pat Horridge wrote:
> >> That's a good idea but I presume you mean via a mapping when creating an
> >> oppertunity from an account.
> >> Unfortunatley the Oppertunity will already exist and the accoutn then
> >> selected from the Potential customer lookup field.
> >> I'd assumed once this field was populated I could access other fields
> >> from that account like creditlimit.
> >> I guess I could look at a work flow to do it but it would be clunky!
> >>
> >> "Kamal" <khitari@NOSPAMhotmail.com> wrote in message
> >> news:e%23eyEozjIHA.4684@TK2MSFTNGP06.phx.gbl...
> >>> not from within the opportunity as the account is the parent here i
> >>> believe.
> >>>
> >>> it would have been possible if it was the way around.
> >>>
> >>> you can either create a webservice call to retrieve the information
> >>> needed from within your jscript on the OnChange event.
> >>>
> >>> However, i got a better way of doing this, why do not you get the
> >>> account status when you are getting the account name and keep it hidden
> >>> in your opportunity form and use it when needed?! i would do it this
> >>> way.
> >>>
> >>> --
> >>>
> >>> Kamal Hitari
> >>> MBSS, MCNPS, MCTS
> >>> 2B.net Ltd
> >>>
http://kamalhitari.blogspot.com
> >>>
> >>> Pat Horridge wrote:
> >>>> Hi I have my oppertunity form that will be populated with an account
> >>>> name (in prospective customer field)
> >>>> I need to then extract the account status (credit limit etc) of that
> >>>> account on change.
> >>>> Is that possible?
> >>>> Any clues would be great.
> >>>> Thanks
> >>
>
>