Quantcast
Channel: Discussion Forum > Connect Data Services
Viewing all articles
Browse latest Browse all 2504

Primary Contact with chaining variables

$
0
0

Topic by Beatriz Navarro

Hi,

I have the following code:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <ns7:ClientInfoHeader soapenv:mustUnderstand="0" xmlns:ns7="urn:messages.ws.rightnow.com/v1_4">
         <ns7:AppID>Basic Create</ns7:AppID>
      </ns7:ClientInfoHeader>
      <wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken>
            <wsse:Username>USER</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PSW</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
     <ns7:Batch xmlns:ns7="urn:messages.ws.rightnow.com/v1_4">
         <ns7:BatchRequestItem>
        <ns7:QueryCSVMsg xmlns:ns7="urn:messages.ws.rightnow.com/v1_4">
            <ns7:Query xsi:type="ChainSourceID" variableName="@idContato">SELECT ID AS '@idContato' FROM Contact WHERE Contact.CustomFields.c.matricula = '123';</ns7:Query>                      
        </ns7:QueryCSVMsg>
 </ns7:BatchRequestItem>
 <ns7:BatchRequestItem>     
          <ns7:CreateMsg xmlns:ns7="urn:messages.ws.rightnow.com/v1_4">        
         <ns7:RNObjects xsi:type="ns4:Incident" xmlns:ns4="urn:objects.ws.rightnow.com/v1_4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <!--Número da ordem-->
            <ns4:CustomFields xsi:type="ns2:GenericObject" xmlns:ns2="urn:generic.ws.rightnow.com/v1_4">
               <ns2:ObjectType>
                  <ns2:TypeName>IncidentCustomFields</ns2:TypeName>
               </ns2:ObjectType>
               <ns2:GenericFields dataType="OBJECT" name="c">
                  <ns2:DataValue>
                     <ns2:ObjectValue xsi:type="ns2:GenericObject">
                        <ns2:ObjectType>
                           <ns2:TypeName>IncidentCustomFields</ns2:TypeName>
                        </ns2:ObjectType>
                        <!--Descrição-->
                        <ns2:GenericFields dataType="STRING" name="descricao">
                           <ns2:DataValue>
                              <ns2:StringValue>Descrição!!</ns2:StringValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                        <ns2:GenericFields dataType="STRING" name="num_inventario">
                           <ns2:DataValue>
                              <ns2:StringValue>RI</ns2:StringValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                        <ns2:GenericFields dataType="STRING" name="centro_custo">
                           <ns2:DataValue>
                              <ns2:StringValue>1234</ns2:StringValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                        <!--Fornecedor-->
                        <ns2:GenericFields dataType="STRING" name="fornecedor">
                           <ns2:DataValue>
                              <ns2:StringValue>Nome do fornecedor</ns2:StringValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                        <!--Início desejado-->
                        <ns2:GenericFields name="inicio_desejado">
                           <ns2:DataValue>
                              <ns2:DateTimeValue>2019-01-08T15:53:44.000+00:00</ns2:DateTimeValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                        <!--Conclusão desejada-->
                        <ns2:GenericFields name="fim_desejado">
                           <ns2:DataValue>
                              <ns2:DateTimeValue>2019-01-08T15:53:44.000+00:00</ns2:DateTimeValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                        <!--Tipo do chamado-->
                        <ns2:GenericFields dataType="NAMED_ID" name="tipo_chamado">
                           <ns2:DataValue>
                              <ns2:NamedIDValue>
                                 <ns1:Name xmlns:ns1="urn:base.ws.rightnow.com/v1_4">Preventiva</ns1:Name>
                              </ns2:NamedIDValue>
                           </ns2:DataValue>
                        </ns2:GenericFields>
                     </ns2:ObjectValue>
                  </ns2:DataValue>
               </ns2:GenericFields>
            </ns4:CustomFields>
            <!--Problema-->
            <ns4:Disposition>
               <!--<ID id="244" xmlns="urn:base.ws.rightnow.com/v1_4"/>-->
               <ns1:Name xmlns:ns1="urn:base.ws.rightnow.com/v1_4">AR CONDICIONADO PARADO</ns1:Name>
            </ns4:Disposition>
             <ns4:FileAttachments>
            <ns4:FileAttachmentList action="add">
                <ns4:Data>dGVzdGU=</ns4:Data>
                <ns4:FileName>test.txt</ns4:FileName>
            </ns4:FileAttachmentList>
     </ns4:FileAttachments>
            <!--Os dados do contato são obrigatórios-->
             <!--<ID id="@idContato" xsi:type='ns2:ChainDestinationID' xmlns="urn:base.ws.rightnow.com/v1_4"/>-->
           <ns4:PrimaryContact>
               <ns4:Contact >                         
    <ID  xsi:type='ChainDestinationID' xmlns="urn:base.ws.rightnow.com/v1_4"  variableName='@idContato' />    
               </ns4:Contact>
            </ns4:PrimaryContact> 

            <!--Categoria-->
            <ns4:Product>
               <!--<ID id="226" xmlns="urn:base.ws.rightnow.com/v1_4"/>-->
               <ns1:Name xmlns:ns1="urn:base.ws.rightnow.com/v1_4">ACJ-AR CONDICIONADO DE JANELA</ns1:Name>
            </ns4:Product>
            <!--Status-->
            <ns4:StatusWithType>
               <ns4:Status>
                  <!--<ID id="102" xmlns="urn:base.ws.rightnow.com/v1_4"/>-->
                  <ns1:Name xmlns:ns1="urn:base.ws.rightnow.com/v1_4">Aberto</ns1:Name>
               </ns4:Status>
            </ns4:StatusWithType>
         </ns7:RNObjects>
         <ns7:ProcessingOptions>
            <ns7:SuppressExternalEvents>false</ns7:SuppressExternalEvents>
            <ns7:SuppressRules>false</ns7:SuppressRules>
         </ns7:ProcessingOptions>
      </ns7:CreateMsg>
         </v1:BatchRequestItem>
      </v1:Batch>
   </soapenv:Body>
</soapenv:Envelope>

I'l like to search a ID contact with "matricula" custom field , insert inside a "idContato" variable , and user this variable as ID in Primary Contact to create a new Incident.

But this code doesn't work. The incident isn't created.

Can you suggest me where I'm going wrong?

Thanks!!

Beatriz.


Viewing all articles
Browse latest Browse all 2504

Trending Articles