• TSME
  • NEWBIE
  • 35 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies
I can't get my SOAP UI to accept the logon.
I've followed the instructions as;
You generate the wsdl for the playgorund.
Copy the username from the settings. i.e fredericklanesquash@curious-goat-486834.com
Requested a new security token from this playgorund
So, it won't accept therefore, I get no session ID

My Request1 Session URL is;  https://login.salesforce.com/services/Soap/c/43.0
My script is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>fredericklanesquash@curious-goat-486834.com</urn:username>
         <urn:password>PasswordxxxxSecurityTokenxxxxx</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

Error is;
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:INVALID_LOGIN</faultcode>
         <faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring>
         <detail>
            <sf:LoginFault xsi:type="sf:LoginFault">
               <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>
               <sf:exceptionMessage>Invalid username, password, security token; or user locked out.</sf:exceptionMessage>
            </sf:LoginFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>
We have a lightning component that does a looup on the asset object based on input in a text field. 
Until yesterday we had following code in our apex controller to perform the query: 

String searchString = '\'*'+userInput+'*\'';
String soslQuery = 'FIND :searchString IN ALL FIELDS RETURNING '
                         + type +'(Id, name,SerialNumber ORDER BY name'+') LIMIT 20';
List<List<SObject>> results =  Search.query(soslQuery);

However today we noticed that this code isn't working anymore as the results list is always empty. 
Replacing the soslQuery code with the following fixes the issue: 

String soslQuery = 'FIND ' + searchString + ' IN ALL FIELDS RETURNING '
                         + type +'(Id, name,SerialNumber ORDER BY name'+') LIMIT 20';

What are wemissing? Isn't a bind variable not supported anymore in these kind of queries? Or is there anything wrong in the use of them? 

Regards,
​Thomas
  • July 18, 2018
  • Like
  • 0
trigger UpdateContactOnAcc2 on Account (after update) {


  for(Account a :Trigger.new)
  {
     list <contact> con = [select lastname, LeadSource  from contact where contact.accountid=:a.id];

     if(trigger.isUpdate)
      {

          
           for(Contact c: con)
           {
             c.LeadSource='Web';
             c.accountid=a.id;
             c.OtherPhone=a.Phone;
           update c;
           } 
      } 
 

  }
  }
//We Update the child record for that account whenever any field (say phone is changed) the same changes should be reflected in the child record
  //updating child record without repeating the query in the loop and running the query only once


This is the Test Class i've written
@isTest
public class TestClassUpdateAcc {
 static testmethod void updateAcc()
   {
     Account acc = new Account();
      acc.Name = 'Loader';
       insert acc;
       acc=[select name,phone from account];
       acc.Phone='98765';
       update acc;
      // acc=[select name, phone from account];
       // System.assertEquals('555', acc.Phone);

       
      Contact con = new Contact();
      con.LastName = 'xxxx';
      con.AccountId =acc.Id;
      con.OtherPhone=acc.Phone;
       con.LeadSource='email';
      insert con;
        con=[select LastName, AccountID,otherphone from contact];
        con.LeadSource='web';
         update con;
     //   System.assertEquals('Web', con.LeadSource);
       
       
 
               
   }
}

 
Code that has stopped working:

---
soslQuery = 'FIND :searchString IN NAME FIELDS RETURNING '
+ typeObject +'(Id, '+nameField+ ' where ' +prefix+filterType+ ' = \'' +filterValue+ '\' ORDER BY '+nameField+') LIMIT 20';
List<List<SObject>> results = Search.query(soslQuery);

---
If we replace the query like the below, it is returning results.

soslQuery = 'FIND \'*' + searchString + '*\' IN NAME FIELDS RETURNING '
+ typeObject +'(Id, '+nameField+ ' where ' +prefix+filterType+ ' = \'' +filterValue+ '\' ORDER BY '+nameField+') LIMIT 20';

SOSL is not honoring the values in the bind variable from today.
We have a lightning component that does a looup on the asset object based on input in a text field. 
Until yesterday we had following code in our apex controller to perform the query: 

String searchString = '\'*'+userInput+'*\'';
String soslQuery = 'FIND :searchString IN ALL FIELDS RETURNING '
                         + type +'(Id, name,SerialNumber ORDER BY name'+') LIMIT 20';
List<List<SObject>> results =  Search.query(soslQuery);

However today we noticed that this code isn't working anymore as the results list is always empty. 
Replacing the soslQuery code with the following fixes the issue: 

String soslQuery = 'FIND ' + searchString + ' IN ALL FIELDS RETURNING '
                         + type +'(Id, name,SerialNumber ORDER BY name'+') LIMIT 20';

What are wemissing? Isn't a bind variable not supported anymore in these kind of queries? Or is there anything wrong in the use of them? 

Regards,
​Thomas
  • July 18, 2018
  • Like
  • 0
Hello everyone,

While developing the trigger the logic can be added in the trigger or can be included in the Handler classes and those handlers can be used in the trigger, will there be any disadvantages of using trigger handlers?
I can't get my SOAP UI to accept the logon.
I've followed the instructions as;
You generate the wsdl for the playgorund.
Copy the username from the settings. i.e fredericklanesquash@curious-goat-486834.com
Requested a new security token from this playgorund
So, it won't accept therefore, I get no session ID

My Request1 Session URL is;  https://login.salesforce.com/services/Soap/c/43.0
My script is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com">
   <soapenv:Header>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>fredericklanesquash@curious-goat-486834.com</urn:username>
         <urn:password>PasswordxxxxSecurityTokenxxxxx</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

Error is;
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:INVALID_LOGIN</faultcode>
         <faultstring>INVALID_LOGIN: Invalid username, password, security token; or user locked out.</faultstring>
         <detail>
            <sf:LoginFault xsi:type="sf:LoginFault">
               <sf:exceptionCode>INVALID_LOGIN</sf:exceptionCode>
               <sf:exceptionMessage>Invalid username, password, security token; or user locked out.</sf:exceptionMessage>
            </sf:LoginFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>