• jigarshah
  • SMARTIE
  • 1786 Points
  • Member since 2012
  • Enterprise Solution Architect


  • Chatter
    Feed
  • 57
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 418
    Replies
Description: When the Primary campaign field from the Opp is Null then that field is updated by the most recent campaign from the primary contact role

Apex class: 

    global class UpdPrimaryCampaignOnOpty implements Database.Batchable<sObject>,Schedulable{
    
        global String Query;
        global UpdPrimaryCampaignOnOpty(){ 
            query = 'Select Id, contactId, opportunityId,isPrimary from OpportunityContactRole where (createddate = today or lastmodifieddate = today) and  opportunity.CampaignId = null';
        }
        
        global void execute(SchedulableContext SC){
            UpdPrimaryCampaignOnOpty upc =  new UpdPrimaryCampaignOnOpty();
            ID batchprocessid = Database.executeBatch(upc);
        }
        
         global DataBase.QueryLocator start(Database.BatchableContext BC){ 
            return Database.getQueryLocator(query);
        }
        global void execute(Database.BatchableContext BC, List<sObject> scope){
            System.debug('scope size = '+scope.size());
            set<Id> conIds = new Set<Id>();
            Set<Id> optyIds = new Set<Id>();
            Map<Id,Id> optyConMap = new Map<Id,Id>();
            for(sObject s : scope){
                OpportunityContactRole ocr = (OpportunityContactRole)s;
                if(ocr.isPrimary){
                    conIds.add(ocr.contactId);
                    optyIds.add(ocr.opportunityId);
                    optyConMap.put(ocr.OpportunityId, ocr.ContactId);
                }
            }
            System.debug('conIds size = '+conIds.size());
            System.debug('optyIds size = '+optyIds.size());
            System.debug('optyConMap size = '+optyConMap.size());
            
            List<CampaignMember> cmList = [Select id, CampaignId, ContactId, Campaign.createddate from CampaignMember where ContactId IN :conIds];
            System.debug('cmList size = '+cmList.size());
            Map<Id,CampaignMember> contactCampaignMap = new Map<Id,CampaignMember>();
            for(CampaignMember cm : cmList){
                
                if(contactCampaignMap.containsKey(cm.contactId) && cm.Campaign.createddate > contactCampaignMap.get(cm.contactId).Campaign.CreatedDate ){
                    contactCampaignMap.put(cm.contactId, cm);
                }
                else{
                    contactCampaignMap.put(cm.contactId, cm);
                }           
            }
            
            List<Opportunity> optyList = [Select Id, CampaignId from Opportunity where Id IN :optyIds];
            
            for(Opportunity opty : optyList){
                if(optyConMap.containsKey(opty.id) && contactCampaignMap.containsKey(optyConMap.get(opty.Id))){
                    opty.CampaignId = contactCampaignMap.get(optyConMap.get(opty.Id)).CampaignId;
                }        
            }
            
            update optyList;
            
        }
        
        global void finish(Database.BatchableContext BC){
           
       }
            
    }
I had deleted a custom object and recreated it with the same name. However, now I am unable to access this Custom Object in App Manager -> New App -> "Select Items" -> "Available Items" list.

How do I solve this? What do I have to do to see this recreated custom object to show in this "Available Items" list?
Hi friends,

I need to look up specific Contacts on Accounts, but only include Contacts on Accounts that have Opportunities WHERE Stage IN('X','Y','Z') i.e. what I think of as a child -> parent -> child lookup. I've been using workbench for this. 

I couldn't figure out a way to do this within the syntax, so instead I opted for Account -> Contacts WHERE Account -> Opportunities meets my criteria, which seemed to make sense to me. However, my query is getting an error telling me I can't have a child -> parent lookup in the where clause:
"MALFORMED_QUERY: 
AND Id IN(SELECT Account.Id FROM Opportunity WHERE
ERROR at Row:5:Column:24
The inner select field 'Account.Id' cannot have more than one level of relationships"

Here is my query:
SELECT Id,
       (SELECT Id FROM Contacts WHERE Send_Partner_Updates__c = TRUE)
FROM Account
WHERE Account.POS_Provider_s__c NOT IN('Toshiba ACE', 'Toshiba ACE (old, non-integrated)')
      AND Id IN(SELECT Account.Id FROM Opportunity WHERE Stage IN('6 - Deployed', '6 - Deploying', '6.5 - Fully Deployed'))

Does anyone have a way to get by this? When I tried "SELECT Id FROM Opportunity", removing the child->parent lookup within the Opportunity query, I get this error: "The selected field 'Id' in the subquery and the left operand field in the where expression in the outer query 'Id' should point to the same object type"...so I haven't been able to think of a way around these two limitations.

Thanks for your help!
I need to query a list of accounts and their related contracts, but I need the accounts listed in order of the contract end dates.

So if Account_A has two contracts with end dates of 1/1/2020 and 1/1/2021
And Account_B has two contracts with end dates of 1/1/2019 and 1/1/2025

Then Account B needs to be on the top of the list because it has a contract which is ending sooner.
Is this possible to do in a single query?
Here's how the syntax would look in my mind if it helps explain what I'm trying to do. This query doesn't work though:
SELECT Id, Name, (SELECT Id, ContractNumber, EndDate FROM Contracts ORDER BY EndDate DESC)
FROM Accounts
ORDER BY Contracts[0].EndDate DESC NULLS LAST
Is this even possible?
Hi friends,

I feel kind of silly posting this, but here goes. In our org, Orders are created on Opportunities and have a start and end date. Orders must also be associated with Contracts, which also have a start and end date. Pretty standard stuff. 

Recently, Date = Today surpassed the Contract End Date for one of our contracts (this is ok and was designed this way - the continuation of the contract is actually recorded in a new "renewal" Opportunity that is tied to the originating Opportunity and the original Contract. We're attempting to create an order on the associated (renewal) Opportunity but getting the following error: "Malformed request https://na34.salesforce.com/services/data/v38.0/sobjects/Order/. Response content: [{'fields': ['EffectiveDate'], 'message': "Order Start Date can't be later than its contract's end date.: Order Start Date", 'errorCode': 'FIELD_INTEGRITY_EXCEPTION'"

This totally looks like a custom validation or error message to me (but please correct me if I'm wrong?? Maybe there's a chance Salesforce built in validation rules for these Standard Salesforce fields and that's what I'm missing here?), but the weird thing is that I can't find mention of the "Order Start Date can't be later than its contract's end date" error ANYWHERE in the org. I've combed through every line of code and validation rule like 3 times and it's nowhere to be found. Is there some other obscure way to create data validation that I'm not aware of? 

Or any other ideas that could point me in the right direction? I need to find the culprit and disable / modify this rule. Thanks so much!
Apex Test Result Detail 
Time Started1/2/2018 12:15 AM
Classaccsearchcontrollertest
Method NameTestclear
Pass/FailFail
Error MessageSystem.NullPointerException: Attempt to de-reference a null object
Stack TraceClass.accsearchController.clear: line 25, column 1
Class.accsearchcontrollertest.Testclear: line 49, column 1


Apex Test Class:-

@isTest 
public class accsearchcontrollertest
{
    @testSetup static void createTestData()
      {

        Account acc= new Account();
        acc.Name='TestAccount';
        acc.Is_Acct_IP_or_RP__c='IP';
        acc.Buying_Groups__c='N/A (none)';
        insert acc;

        Opportunity op = new Opportunity ();
        op.Name = 'Test' ;
        op.Accountid= acc.Id;
        op.StageName='A = Market Participant';
        op.CloseDate= System.today() + 5;
        insert op;

        Quote qt = new Quote();
        qt.Name = 'Test123';
        qt.CBG_Employee_Responsible__c = UserInfo.getUserId();
        qt.CBG_Incoterms__c = 'CFR';
        qt.CBG_PaymentTerms__c = 'CO04 payable immediatly';
        qt.Format__c = 'List';
        qt.CBG_SAPQuoteNumber__c = '30010012';
        qt.OpportunityId=op.id; 
        insert qt;

      }
      
    static TestMethod void TestprocessLinkClick()
      {
      
        PageReference pref1 = Page.CBG_SearchQuote ;   
        Test.setCurrentPage(pref1);   
        accsearchcontroller Obj = new accsearchcontroller();
        Obj.searchstring = '30010012';  
        //Obj.clear();
        Obj.processLinkClick();
        
      }   
    static TestMethod void Testclear()//////////////////////////////////This one failing---->How to pass value to search string
      {
      
        
        accsearchcontroller Obj = new accsearchcontroller();
        Obj.searchstring = '30010012';  
        Obj.clear();  
             
     }  

   static TestMethod void Testsearch()
      {
      
        accsearchcontroller Obj = new accsearchcontroller();
        Obj.search();
        
      }  
    
}


Apex Class:-

public with sharing class accsearchController 
{

    public accsearchcontroller(ApexPages.StandardController controller) {

    }


public String l { get; set; }
public list <quote> acc {get;set;}
public string searchstring {get;set;}
public String quoteid{get; set;}
public Boolean search{get; set;}
public Boolean result{get; set;}
public accsearchcontroller( ) 
{
}
public void search(){
string searchquery='select QuoteNumber,Name,Email,Opportunity.Name,CBG_SAPQuoteNumber__c ,CBG_Phoenix_Offer_Number__c from quote where CBG_SAPQuoteNumber__c like \'%'+searchstring+'%\' OR CBG_SAPQuoteNumber__c like \'*'+searchstring+'*\' OR  CBG_Phoenix_Offer_Number__c like \'%'+searchstring+'%\' OR  CBG_Phoenix_Offer_Number__c  like \'*'+searchstring+'*\' Limit 20';
acc= Database.query(searchquery);
}
public void clear(){
acc.clear();

}
public PageReference processLinkClick() {
         
        search = false;
        result = false;
        
        Pagereference p1 = new PageReference('https://cs84.salesforce.com/'+quoteid);
        p1.setRedirect(true);
        return p1;
    }
}
We are seeing sporadic "Internal Salesforce.com Error" for SOQL using an external object. When it works SOQL returns value and I am able to see the results. I am not able to put finger on what is causing this internal error and what it means. Any insight to debug the issue would be really helpful. 

Following is snippet of Debug log - 

6:37:16.0 (15971342)|SOQL_EXECUTE_BEGIN|[42]|Aggregations:0|SELECT Id, start_at__c, end_at__c, Id__c, name__c, canvasId__c FROM courses__x WHERE (canvasId__c = :tmpVar1 AND start_at__c <= TODAY AND end_at__c >= TODAY) ORDER BY end_at__c ASC NULLS FIRST
16:37:16.0 (982620934)|FATAL_ERROR|Internal Salesforce.com Error
16:37:16.0 (982666130)|CODE_UNIT_FINISHED|CBS_CourseController.getCoursesForCurrentUser
16:37:16.0 (987728779)|CODE_UNIT_FINISHED|Aura
I need help creating a validation rule that will prevent users from closing a case if there are any open/pending tasks associated with it. Would this be best done as Case Validation Rule? 
  • December 26, 2017
  • Like
  • 0
Just failed my Admin 201 test. I'm so angry and frustrated. I took a ton of practice tests and did well on them. The actual test was nothing like the practice test. The actual test was ridiculously vague.  Anyway, does anyone know where I can find practice tests that are actually up-to-date? Any suggestions on how to study that doesn't cost a billion dollars? I'm just super frustrated and angry right now. Thanks for the help. 
I have a custom object using a Visualforce page with a related list for 'Files.' The File related list can contain a PDF version of the Visualforce page that is generated by the controller to memorialize content. If an executive reviews and comments on the Visualforce page and creates the PDF how can I prevent a File from being deleted by the owner of the custom object if certain fields are populated/updated by an executive reviewer ?
<apex:relatedList list="AttachedContentDocuments"  id="FilesList" />

 
Hi all,
I'm new to SF. I have a requirement where if a value from a region picklist(UK) is selected, it should unlock other picklist field with its sub-regions(UK). If other picklist value(Non uk) is selected, it should not populate. Can anyone help me with this requirement.

Thank you in advance
SK
Hi,

I was trying to upload Dupicate Rules along with Correspondng Matching rules from partial SB to Full SB but got the following error while validating the Inbound change sets. basically the error is related to the duplicate rules order on a custom object. I wrote 3 rules on that object but no clue how to set the order.
 
AQAddress__c.Address_Duplicate_Matching_Rule	Duplicate Rule	0	0	SortOrder must be in sequential order from 1.

 
Hello,
Is it possible to use exsiting Salesforce picklist values in a Flow?  And if you can, is it possible to use dependent picklists?
Thanks
We have created a Connected App in our developer account.  Other developer accounts can connect to it and use it.

Trial accounts can connect to it, but don't by default have API access.

Will Professional users with API access, Enterprise, and Unlimited users be able to use the Connected App specified in our developer account, or do we need to have a paid Salesforce account in which to re-create the Connected App for "production" use?
I have a nightly upload to salesforce which maps a string from my database to a custom field in sfdc using jitterbit. 
What I want to do is append the string that is already in sfdc to the new string that is coming in from the nightly upload and build up the string.
Basically we have account notes in my db that need to be added to a text area to sfdc without having to re upload the entire account notes table.
So for example, the text area shows:
Dec 10, 2017 called customer
Dec 9, 2017 payment made 
....

After the nightly upload it would show:
Dec 11, 2017 account closed
Dec 10, 2017 called customer
Dec 9, 2017 payment made
...

The upload would only have the string "Dec 11, 2017 account closed" and that would be appended the string
Dec 10, 2017 called customer
Dec 9, 2017 payment made


It would be simple if i can modify the value with itself but that can't be done in a formula, i.e.
newString = "Dec 11, 2017 account closed<br/>"
currentString = "Dec 10, 2017 called customer<br/>Dec 9, 2017 payment made"
currentString = newString + currentString 

I was thinking of a bunch of placeholder fields to hold intermediate values however I can't seen to figure out the logic to do this. 
I was thinking maybe to do something like this (each variable is a custom field)
newString //coming in from the db upload
currentString = newString  + oldString // formula field to show in the text area the newString appended with the string already in sfdc
oldString = currentString // formula field to hold the current string 

Are there any potential issues here?  Any experienced admin/developers that can provide any comments or how they would approach this issue?
I am pretty new to sfdc so I have not had any experience with workflow rules. Would that be a more proper way to tackle this issue? If so how would that be implemented?

Thanks in advance.





 
Hi, I create an unmanaged package in a Development Edition and I need to install on another site to test if it works ok. How can I do it? what kind of account do I need?

I try on a trial version of Professional Edition but have the following error:

This app can't be installed.
There are problems that prevent this package from being installed.
Apex Classes(classes/MockHttp_GetConditions.cls-meta.xml) Missing featureInstalling this package requires the following feature and its associated permissions: Apex Classes


What should I do?

Thanks
Pablo
Hi all, 

I ha ve been doing the Reports & Dashboards Specialist Superbadge and i set up the reports incorrectly. I decided to start from scratch and i deleted the old reports with a view to recreating them correctly. The issue i have run into is that i cannot recreate the reports with the nameing conventions required and i am hoping there is a way i can completly delete the incorrect reports including the unique name?

Thanks in advance for your response. 
Please help me write Test class. I am using this class in a Lightning component to update a Record in a detail page. I am new to salesforce and unable to figure out how to write test class and get my class covered. Thanks in advance.

Apex Class:
public class ApproveAP {
    @AuraEnabled
    public static String updatepayable(String payId) {
        String msg = 'Approved';
        try {
            update new AcctSeed__Account_Payable__c(id = payId, AcctSeed__Status__c = 'Approved');
        }
        catch(Exception e) {
            msg = e.getMessage();
        }
        return msg;
    }
}
Test Class : 
@isTest
private class TestApproveAP
   {
 private static Testmethod string updatepayable(){
   string msg = 'Test Message';
      List<AcctSeed__Account_Payable__c> accList = new List<AcctSeed__Account_Payable__c>();
      accList.add(
      new AcctSeed__Account_Payable__c(
       id='tempId',
      AcctSeed__Status__c = 'Waiting for Approval'
      )
      );
      insert accList;
  
  try{
  update new AcctSeed__Account_Payable__c(id = 'tempId', AcctSeed__Status__c = 'Approved');
  }catch(Exception e){msg=e.getMessage();
   ApproveAP app = new ApproveAP();
   }
  return msg;
 }
 }
I need to create a field that returns the 15th of any month that opportunity is closed in. I think this should be simple but I cannot make it work.  Needs to be a Date value in the end. 

So basically if an Opp is closed in June 2017 then field should display 15/06/2017

Please help?
my old force.com 100 free license org has just started a 90 day countdown (showing 86 days remaining in the top right hand corner).
has anybody else had this just happen?

I am facing an issue while performing Apex REST integration. I am using the following piece of code to expose my Apex method as a REST Service which another entity can post data to. My code is as follows

 

@RestResource (urlMapping ='/postlead/*')

global class HttpPostHandler{

 

    @HttpPost

    global static void handleHttpPost(){

             

       //Code to create a new record          

    }

}

 

Another application would perform an Http Post to my Apex REST URL however it does not involve any code and only allows configuration of parameters required to achieve a successful post to the below mentioned REST URL. I have configured the following attributes on the application that would be performing the Http Post to my Apex REST functionality.

 

Endpoint URL:  https://<salesforce.com instance>/services/apexrest/postlead

 

Credentials: Username /Password for my sfdc org

 

Header Parameters:  None

 

However when the application performs a Http Post the following error message is returned by SFDC.

[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]


I tried performing a little RnD and also found certain other posts on the Salesforce discussion boards which suggest that we

need to add an OAuth token as a header to the http post request.  My issues are:

 

  1. How do we get the value of the OAuth token that needs to be passed?
  2. How should it exactly be passed in the Http Header?
  3. Are there any other parameters that are required to be passed in the Http Headers to achieve a successful Http Post? If yes, then what are they, what values should be given for each param and how to pass them?

 

Please suggest.

This is my first day using this, and I have already run into an issue. So I am on the Install Apps and Packages in Your Trailhead Playground Unit and I accidently installed the Dreamhous app package not in the playground. It will not let me uninstall. Secondly, I can not seem to find the Trailhead Playground at all. I have gone up and down this froum and have found no solution. It says that it should be at the bottom where the challenge is, and there is no option for it, Please help.
Description: When the Primary campaign field from the Opp is Null then that field is updated by the most recent campaign from the primary contact role

Apex class: 

    global class UpdPrimaryCampaignOnOpty implements Database.Batchable<sObject>,Schedulable{
    
        global String Query;
        global UpdPrimaryCampaignOnOpty(){ 
            query = 'Select Id, contactId, opportunityId,isPrimary from OpportunityContactRole where (createddate = today or lastmodifieddate = today) and  opportunity.CampaignId = null';
        }
        
        global void execute(SchedulableContext SC){
            UpdPrimaryCampaignOnOpty upc =  new UpdPrimaryCampaignOnOpty();
            ID batchprocessid = Database.executeBatch(upc);
        }
        
         global DataBase.QueryLocator start(Database.BatchableContext BC){ 
            return Database.getQueryLocator(query);
        }
        global void execute(Database.BatchableContext BC, List<sObject> scope){
            System.debug('scope size = '+scope.size());
            set<Id> conIds = new Set<Id>();
            Set<Id> optyIds = new Set<Id>();
            Map<Id,Id> optyConMap = new Map<Id,Id>();
            for(sObject s : scope){
                OpportunityContactRole ocr = (OpportunityContactRole)s;
                if(ocr.isPrimary){
                    conIds.add(ocr.contactId);
                    optyIds.add(ocr.opportunityId);
                    optyConMap.put(ocr.OpportunityId, ocr.ContactId);
                }
            }
            System.debug('conIds size = '+conIds.size());
            System.debug('optyIds size = '+optyIds.size());
            System.debug('optyConMap size = '+optyConMap.size());
            
            List<CampaignMember> cmList = [Select id, CampaignId, ContactId, Campaign.createddate from CampaignMember where ContactId IN :conIds];
            System.debug('cmList size = '+cmList.size());
            Map<Id,CampaignMember> contactCampaignMap = new Map<Id,CampaignMember>();
            for(CampaignMember cm : cmList){
                
                if(contactCampaignMap.containsKey(cm.contactId) && cm.Campaign.createddate > contactCampaignMap.get(cm.contactId).Campaign.CreatedDate ){
                    contactCampaignMap.put(cm.contactId, cm);
                }
                else{
                    contactCampaignMap.put(cm.contactId, cm);
                }           
            }
            
            List<Opportunity> optyList = [Select Id, CampaignId from Opportunity where Id IN :optyIds];
            
            for(Opportunity opty : optyList){
                if(optyConMap.containsKey(opty.id) && contactCampaignMap.containsKey(optyConMap.get(opty.Id))){
                    opty.CampaignId = contactCampaignMap.get(optyConMap.get(opty.Id)).CampaignId;
                }        
            }
            
            update optyList;
            
        }
        
        global void finish(Database.BatchableContext BC){
           
       }
            
    }
I need help to create a workflow or process to update one field after checking another field from an Object which is a child of a Grand Parent Object.

Example:-
C is child of B 
B is child of A
K is also another Child of A

I need a workflow or process that when C is created, a field in C should be updated from a field in K.

I cannot use formulae as the field in C should be editable later.
 
I am trying to create a new application using Salesforce and was wondering if it is better to start creating it in the Lightning Experience or try to first create the application in Classic and then transition later.
SO frustrating. I'm spending all my time creating logins for multiple Salesforce sites (I've got at least 3, perhaps 4). Don't know why, or what they're for. Can't even complete the most basic modules (and I've got a Master's degree, I'm not stupid). Can we just keep it simple and actually learn the platform and stop with the "now you have to go to this site in an incognito window and create yet another login and use this fake username" stuff?

Grrrrrrr
Hi friends,

I need to look up specific Contacts on Accounts, but only include Contacts on Accounts that have Opportunities WHERE Stage IN('X','Y','Z') i.e. what I think of as a child -> parent -> child lookup. I've been using workbench for this. 

I couldn't figure out a way to do this within the syntax, so instead I opted for Account -> Contacts WHERE Account -> Opportunities meets my criteria, which seemed to make sense to me. However, my query is getting an error telling me I can't have a child -> parent lookup in the where clause:
"MALFORMED_QUERY: 
AND Id IN(SELECT Account.Id FROM Opportunity WHERE
ERROR at Row:5:Column:24
The inner select field 'Account.Id' cannot have more than one level of relationships"

Here is my query:
SELECT Id,
       (SELECT Id FROM Contacts WHERE Send_Partner_Updates__c = TRUE)
FROM Account
WHERE Account.POS_Provider_s__c NOT IN('Toshiba ACE', 'Toshiba ACE (old, non-integrated)')
      AND Id IN(SELECT Account.Id FROM Opportunity WHERE Stage IN('6 - Deployed', '6 - Deploying', '6.5 - Fully Deployed'))

Does anyone have a way to get by this? When I tried "SELECT Id FROM Opportunity", removing the child->parent lookup within the Opportunity query, I get this error: "The selected field 'Id' in the subquery and the left operand field in the where expression in the outer query 'Id' should point to the same object type"...so I haven't been able to think of a way around these two limitations.

Thanks for your help!

I have created 4 VF pages. 2 for case creation on comm portal (different types) and 2 for internal support agents. As we have come a long way we now also have 4 controller extensions.
  • case type A - Portal
  • case type B - portal
  • case type A - internal
  • case type B - internal
Now all these extensions have lot's of different conditions to retrieve options for creating a case. I know it's not ideal to keep these 4 extensions but given the situation, we have already made huge steps in efficiency and most of all .. eliminate JavaScript. 

However .. we would like to make it more efficient as the final method within these extensions all deal with the actual insert of the case record. We would like to create a separate class providing a single method to actually perform the insert.
//** Mapping of values for case record creation
            objCase.RecordTypeId          = RecType.id;
            objCase.AssetId                     = AssetID;
            objCase.BusinessHoursId     = objCase.Entitlement.BusinessHoursId;

            If (IsMainContactTypeValue == 'Partner'){ 
                objCase.CaseCreatedByPartnerUser__c = true;
            } else {
                objCase.CaseCreatedByPartnerUser__c = false;
            }


            try{
                insert objCase;
            } catch (Exception e){
                System.debug('** ** ** Controller || Creation of Service Request failed  ....');
            }
Now, in general, the mapping of these various case fields for every type of case record is the same. Some have fewer values .. could be explicitly NULL.

Now my question is .. would .. it be easy to create another controller providing a method to actually create the case and prevent repeating the mapping of values in each extension as when we need to add/remove a field .. we need to make sure it's done in all 4 classes. if possible please share the basic idea ...
Trying to complete the "Create an approval process that validates when a Prospect Account becomes a Customer."

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Account number must be 8 characters long.: [AccountNumber]

 
 using (var auth = new Enterprise.SoapClient())
            {
                var userId = "XXX";

                var password = "XXX";
                 
                Enterprise.LoginResult result = auth.login(null, new Enterprise.CallOptions(), userId , password);
   
                var client = new SendSMSContactControllerPortTypeClient();

                client.SendSMSContact(new SessionHeader() { sessionId = result.sessionId }, new CallOptions(), null, null,
                   model.PhoneNumber, model.Message); 
            }


My question is for some reason the "SendSMSContact" returns following error, any sugessions or ideas are greatly appreciated.

Exception Details:

Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: This error usually occurs after a session expires or a user logs out.
Hi there,

We are looking for talented SF developers (various positions)

If you are looking for fresh new challenges, do get in touch with me.

Thanks
Tin