Quantcast
Channel: FetchXML campos Lookup
Viewing all articles
Browse latest Browse all 6

FetchXML campos Lookup

$
0
0

Pessoal,

Tenho um campo Lookup na Entidade Conta onde tenho todos os Municípios, na Entidade Conta faço um consulta a um webservice que retorna o Endereço através do CEP. Portanto, para informar o municipio que retorna da consulta do webservice preciso buscar o ID do Município para lançar o valor para o Lookup.

Utilizei o seguinte JavaScript:

function busca_municipio() {var municipio = Xrm.Page.getAttribute("name").getValue();//Xml com os parametro para consultavar fecthXml = '<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">';
    fecthXml += '<entity name="new_municipio">';
    fecthXml += '<attribute name="new_municipioid" />';
    fecthXml += '<attribute name="new_municipioid" />';
    fecthXml += '<attribute name="new_nomemunicipio" />';
    fecthXml += '<attribute name="createdon" />';
    fecthXml += '<order attribute="new_nomemunicipio" descending="false" />';//filtro por Nome do Município
    fecthXml += '<filter type="and">';
    fecthXml += '<condition attribute="new_municipioid" operator="eq" value="' + municipio + '" />';
    fecthXml += '</filter>';
    fecthXml += '</entity>';
    fecthXml += '</fetch>';var Xml = "<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\">"
    Xml += GenerateAuthenticationHeader()
    Xml += "<soap:Body>";
    Xml += "<Fetch xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">";
    Xml += "<fetchXml>";
    Xml += FetchEncode(Xml);
    Xml += "</fetchXml>";
    Xml += "</Fetch>";
    Xml += "</soap:Body>";
    Xml += "</soap:Envelope>";var XmlHttp = CreateXmlHttpObject();
    XmlHttp.open("POST", "/mscrmservices/2007/crmservice.asmx", false);
    XmlHttp.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Fetch");
    XmlHttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    XmlHttp.setRequestHeader("Content-Length", Xml.length);
    XmlHttp.send(Xml);var resultXml = xmlHttpRequest.responseXML;var id = resultXml.selectSingleNode('./id').text;
    alert(id[0].text);
}

Retorna o seguinte erro: 'Objeto Esperado'

 

Alguém tem alguma dica?

 

Abss.


Viewing all articles
Browse latest Browse all 6

Trending Articles


Vimeo 10.7.1 by Vimeo.com, Inc.


UPDATE SC IDOL: TWO BECOME ONE


KASAMBAHAY BILL IN THE HOUSE


Girasoles para colorear


Presence Quotes – Positive Quotes


EASY COME, EASY GO


Love with Heart Breaking Quotes


Re:Mutton Pies (lleechef)


Ka longiing longsem kaba skhem bad kaba khlain ka pynlong kein ia ka...


Vimeo 10.7.0 by Vimeo.com, Inc.


FORECLOSURE OF REAL ESTATE MORTGAGE


FORTUITOUS EVENT


Pokemon para colorear


Sapos para colorear


Smile Quotes


Letting Go Quotes


Love Song lyrics that marks your Heart


RE: Mutton Pies (frankie241)


Hato lada ym dei namar ka jingpyrshah jong U JJM Nichols Roy (Bah Joy) ngin...


Long Distance Relationship Tagalog Love Quotes



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>