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

Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC

Trending Articles


Ang Nobela sa “From Darna to ZsaZsa Zaturnnah: Desire and Fantasy, Essays on...


Lola Bunny para colorear


Dino Rey para colorear


Girasoles para colorear


Dibujos de animales para imprimir


Renos para colorear


Dromedario para colorear


Long Distance Relationship Tagalog Love Quotes


Tagalog Long Distance Relationship Love Quotes


RE: Mutton Pies (mely)


Gwapo Quotes : Babaero Quotes


Kung Fu Panda para colorear


Libros para colorear


Mandalas de flores para colorear


Dibujos para colorear de perros


Toro para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Love Quotes Tagalog


Tropa Quotes


Mga Tala sa “Unang Siglo ng Nobela sa Filipinas” (2009) ni Virgilio S. Almario





Latest Images

Pangarap Quotes

Pangarap Quotes

Vimeo 10.7.0 by Vimeo.com, Inc.

Vimeo 10.7.0 by Vimeo.com, Inc.

HANGAD

HANGAD

MAKAKAALAM

MAKAKAALAM

Doodle Jump 3.11.30 by Lima Sky LLC

Doodle Jump 3.11.30 by Lima Sky LLC