• Ben.Schauerhamer
  • NEWBIE
  • 15 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 2
    Replies
I have a similar query to:
FIND {O\-*} IN ALL FIELDS RETURNING Opportunity(AccountId WHERE Sales_Credit__c='a1mG0000004VU...'  ORDER BY LastModifiedDate DESC NULLS LAST).



I am having a hard time with a SOSLIf I run that query I get no results. If I change it to below I get 2 results.
 
FIND {O\-89*} IN ALL FIELDS RETURNING Opportunity(AccountId WHERE Sales_Credit__c='a1mG0000004VU...'  ORDER BY LastModifiedDate DESC NULLS LAST).

If I remove the WHERE clause with just FIND {O\-*} it returns all of the results.
 
FIND {O\-89*} IN ALL FIELDS RETURNING Opportunity(AccountId ORDER BY LastModifiedDate DESC NULLS LAST).
I can succesfully run the query on our full sandbox. Any help will be greatly appreciated.
I have gotten a decent understanding of VisualForce and Apex, but with JavaScript I am struggling. The issue that I am coming up against is I have a headless flow that is triggered from an Apex class upon data entry. The basic premis of the flow is to add a contact to an opportunity along with some other items in the background.

I would like this VisualForce page that you enter the data on to be a Publisher Action, however I cannot figure out how to refresh the feed and reset the VisualForce page upon finishing the Flow. 

The VF button is simple: 
<apex:commandButton action="{!runFlow}" value="Save" id="theButton" />

And the Apex for running the Flow:
public void runFlow(){
        flowParams.put('firstName', firstName);
        flowParams.put('lastName', lastName);
        Flow.Interview.FlowRun newFlowRun = new Flow.Interview.FlowRun(flowParams);
        newContractSigner.start();
        flowReturnValue = (String) FlowRun.getVariableValue('contactId');
    }

Thanks
I have created a simple Validation rule that states if Record Name = "RecordX" and Custom Setting Can Edit All Records != TRUE then you cannot edit the record. 

I have one test that is not working with the validation rule. I have put in the debug logs the current user and it is running with my user which it should. I can edit the record through the UI but the test validation rule is in place with the test.

Test Method:
@istest
public with sharing class OomasyncpageeExtension_test{
    testmethod static void OSPETmethod(){
        //create data
        
        User U = [SELECT Id FROM User WHERE Profile.Name='System Administrator' and isActive=true LIMIT 1];
        system.debug('User U::--::'+U);
        
        Ooma__c OCS_one = new Ooma__c (Name = 'Change Info', End_Point_URL__c = 'http://site.com' );
        insert OCS_one;
        
        ooma__c OCS_two = new Ooma__c (Name = 'Change or Cancel', End_Point_URL__c = 'site.com');
        insert OCS_two;
        
        id OSRT = Schema.SObjectType.service__c.getRecordTypeInfosByName().get('Voice Service').getRecordTypeId();
        id OOrt = Schema.SObjectType.opportunity.getRecordTypeInfosByName().get('Voice: New Sale').getRecordTypeId();
        
        Account acct = new Account(Name = 'First last');
        insert acct;
        
        Contact con = new Contact(AccountId = acct.Id, FirstName = 'first', LastName = 'last', EMail = 'someone@somewhere.com');
        insert con;
        
        Zuora__CustomerAccount__c bAcc=new Zuora__CustomerAccount__c();
        bAcc.Name='Test Bill';
        bAcc.Zuora__Account__c=acct.Id; 
        bAcc.Zuora__BillCycleDay__c = '1st of the month';
        bAcc.Zuora__BillToAddress1__c = '125 fake street';
        bAcc.Zuora__BillToAddress2__c = '';
        bAcc.Zuora__BillToState__c = 'UT';
        bAcc.Zuora__BillToPostalCode__c = '84058';
        bAcc.Zuora__BillToCity__c = 'Provo';
        bAcc.Zuora__BillToCountry__c = 'US';
        bAcc.Send_to_Collections__c = false;
        bAcc.Cancel_Billing_Account__c = false;
        Insert bAcc;
        
         Vivint_Employee__C VE = new Vivint_Employee__C (Name = 'Testname', Employee_ID__c ='999990');
        insert VE;
        system.debug('Inserted VE');
        
        opportunity oppty = new opportunity();
        Oppty.AccountId = acct.id;
        oppty.Billing_Address_Same_As_Service__c = true;
        oppty.Sales_Credit__c = VE.id;
        oppty.CloseDate = date.today();
        oppty.stageName = 'Submit For Enrollment';
        oppty.Billing_Account__c = bAcc.id;
        oppty.Contract_Signer__c = con.id;
        oppty.Service_Address_1__c = '125 fake street';
        oppty.Service_Address_2__c = '';
        oppty.Service_Address_City__c = 'Fake City';
        oppty.Service_Address_Postal_Code__c = '55555';
        oppty.Service_Address_State__c = 'CA';
        oppty.Service_Address_Country__c = 'US';
        oppty.Service_Level__c = 'Standard';
        oppty.RecordTypeId = oort;
        oppty.Name = 'Test Oppty';
        insert oppty;
        
        service__c OS = new Service__c (Account__c = acct.id, Initial_Opportunity__c = oppty.Id , Billing_Account__c = bAcc.id, Status__c = 'Active',  VOIP_Hardware_Serial_Number__c = 'Hardware serial 1', VOIP_Hardware_Serial_Number2__c= 'Hardware serial 2', RecordTypeId = OSRT, VOIP_internal_ID__c = '1234', VOIP_E911_State__c = 'CA', VOIP_E911_Postal_Code__c = '55555', VOIP_E911_Country_Code__c = 'US' ,VOIP_E911_City__c = 'test city', VOIP_E911_Address__c = 'test address', Service_level__c = 'Basic');
        OS.Contract_Signer__c = con.id;
        System.debug('Debug::: Service Record: ' + OS);
        System.debug('Current User: ' + UserInfo.getUserName());
        System.debug('Current Profile: ' + UserInfo.getProfileId());
        insert OS; 
        
        PageReference PG = Page.oomaSyncPage;
        Test.setCurrentPage(PG);
        ApexPages.currentPage().getParameters().put('id', string.valueOf(OS.id));
        Apexpages.standardcontroller stdcontroller = new Apexpages.standardcontroller(OS);
        OOmaSyncPageExtension a = new OOmaSyncPageExtension(stdcontroller);
        
        Test.startTest(); 
        Test.setMock(HttpCalloutMock.class, new OOmasyncpageextMHRG());
        
        a.oomacontactsync();
        a.nosync();
        Test.Stoptest();
    }//closing testmethod
}// closing class

Validation Rule:
AND( RecordType.DeveloperName = 'Voice_Record_Type',  !$Setup.Can_Modify_All_Services__c.Bypass_Service_Validation_Rules__c )

As mentioned before the Debug log says the Current User is me and the Profile Id is the Sys Admin Id. 
 
I am currently trying to setup Live Agent and am running into difficulties on search. There are two scenarios where a customer could request a chat, the first is through our Account Center where I would pass all of their information through the deployment JavaScript. The second would be using a pre-chat form where the customer can enter their information.

The problem that I have is currently a customer's email can be in the system multiple times but the name could be different due to a spouse using the same email address, or that contact could be duplicated on multiple accounts as a different type of contact. 

I was wondering if it is possible using the "liveagent.prechat.findorcreate.map.doFind:Contact" to search on both email and first name or on email and then the account number, which is the name on the account they are tied to. Or if you can only search on one field.
Pardon the "newbie" question.

I am querying a custom object and would like to display the owner name on a VisualForce page with the list of objects that meet the criteria. The Apex Code that I am running is:
<pre>
public List<CustomObject__c> getCustomObject() {
  List<CustomObject__c> customObject = [SELECT Name, Owner.Name, FROM Custom_Object__c];
  return customObject;
</pre>

The VF Code I am using is
<pre>
<apex:repeat var="object" value="{!customObject}">
  {!object.Owner.Name}
</apex:repeat>

Any help would be greatly appreciated.
I am currently trying to setup Live Agent and am running into difficulties on search. There are two scenarios where a customer could request a chat, the first is through our Account Center where I would pass all of their information through the deployment JavaScript. The second would be using a pre-chat form where the customer can enter their information.

The problem that I have is currently a customer's email can be in the system multiple times but the name could be different due to a spouse using the same email address, or that contact could be duplicated on multiple accounts as a different type of contact. 

I was wondering if it is possible using the "liveagent.prechat.findorcreate.map.doFind:Contact" to search on both email and first name or on email and then the account number, which is the name on the account they are tied to. Or if you can only search on one field.
I have created a simple Validation rule that states if Record Name = "RecordX" and Custom Setting Can Edit All Records != TRUE then you cannot edit the record. 

I have one test that is not working with the validation rule. I have put in the debug logs the current user and it is running with my user which it should. I can edit the record through the UI but the test validation rule is in place with the test.

Test Method:
@istest
public with sharing class OomasyncpageeExtension_test{
    testmethod static void OSPETmethod(){
        //create data
        
        User U = [SELECT Id FROM User WHERE Profile.Name='System Administrator' and isActive=true LIMIT 1];
        system.debug('User U::--::'+U);
        
        Ooma__c OCS_one = new Ooma__c (Name = 'Change Info', End_Point_URL__c = 'http://site.com' );
        insert OCS_one;
        
        ooma__c OCS_two = new Ooma__c (Name = 'Change or Cancel', End_Point_URL__c = 'site.com');
        insert OCS_two;
        
        id OSRT = Schema.SObjectType.service__c.getRecordTypeInfosByName().get('Voice Service').getRecordTypeId();
        id OOrt = Schema.SObjectType.opportunity.getRecordTypeInfosByName().get('Voice: New Sale').getRecordTypeId();
        
        Account acct = new Account(Name = 'First last');
        insert acct;
        
        Contact con = new Contact(AccountId = acct.Id, FirstName = 'first', LastName = 'last', EMail = 'someone@somewhere.com');
        insert con;
        
        Zuora__CustomerAccount__c bAcc=new Zuora__CustomerAccount__c();
        bAcc.Name='Test Bill';
        bAcc.Zuora__Account__c=acct.Id; 
        bAcc.Zuora__BillCycleDay__c = '1st of the month';
        bAcc.Zuora__BillToAddress1__c = '125 fake street';
        bAcc.Zuora__BillToAddress2__c = '';
        bAcc.Zuora__BillToState__c = 'UT';
        bAcc.Zuora__BillToPostalCode__c = '84058';
        bAcc.Zuora__BillToCity__c = 'Provo';
        bAcc.Zuora__BillToCountry__c = 'US';
        bAcc.Send_to_Collections__c = false;
        bAcc.Cancel_Billing_Account__c = false;
        Insert bAcc;
        
         Vivint_Employee__C VE = new Vivint_Employee__C (Name = 'Testname', Employee_ID__c ='999990');
        insert VE;
        system.debug('Inserted VE');
        
        opportunity oppty = new opportunity();
        Oppty.AccountId = acct.id;
        oppty.Billing_Address_Same_As_Service__c = true;
        oppty.Sales_Credit__c = VE.id;
        oppty.CloseDate = date.today();
        oppty.stageName = 'Submit For Enrollment';
        oppty.Billing_Account__c = bAcc.id;
        oppty.Contract_Signer__c = con.id;
        oppty.Service_Address_1__c = '125 fake street';
        oppty.Service_Address_2__c = '';
        oppty.Service_Address_City__c = 'Fake City';
        oppty.Service_Address_Postal_Code__c = '55555';
        oppty.Service_Address_State__c = 'CA';
        oppty.Service_Address_Country__c = 'US';
        oppty.Service_Level__c = 'Standard';
        oppty.RecordTypeId = oort;
        oppty.Name = 'Test Oppty';
        insert oppty;
        
        service__c OS = new Service__c (Account__c = acct.id, Initial_Opportunity__c = oppty.Id , Billing_Account__c = bAcc.id, Status__c = 'Active',  VOIP_Hardware_Serial_Number__c = 'Hardware serial 1', VOIP_Hardware_Serial_Number2__c= 'Hardware serial 2', RecordTypeId = OSRT, VOIP_internal_ID__c = '1234', VOIP_E911_State__c = 'CA', VOIP_E911_Postal_Code__c = '55555', VOIP_E911_Country_Code__c = 'US' ,VOIP_E911_City__c = 'test city', VOIP_E911_Address__c = 'test address', Service_level__c = 'Basic');
        OS.Contract_Signer__c = con.id;
        System.debug('Debug::: Service Record: ' + OS);
        System.debug('Current User: ' + UserInfo.getUserName());
        System.debug('Current Profile: ' + UserInfo.getProfileId());
        insert OS; 
        
        PageReference PG = Page.oomaSyncPage;
        Test.setCurrentPage(PG);
        ApexPages.currentPage().getParameters().put('id', string.valueOf(OS.id));
        Apexpages.standardcontroller stdcontroller = new Apexpages.standardcontroller(OS);
        OOmaSyncPageExtension a = new OOmaSyncPageExtension(stdcontroller);
        
        Test.startTest(); 
        Test.setMock(HttpCalloutMock.class, new OOmasyncpageextMHRG());
        
        a.oomacontactsync();
        a.nosync();
        Test.Stoptest();
    }//closing testmethod
}// closing class

Validation Rule:
AND( RecordType.DeveloperName = 'Voice_Record_Type',  !$Setup.Can_Modify_All_Services__c.Bypass_Service_Validation_Rules__c )

As mentioned before the Debug log says the Current User is me and the Profile Id is the Sys Admin Id. 
 
Pardon the "newbie" question.

I am querying a custom object and would like to display the owner name on a VisualForce page with the list of objects that meet the criteria. The Apex Code that I am running is:
<pre>
public List<CustomObject__c> getCustomObject() {
  List<CustomObject__c> customObject = [SELECT Name, Owner.Name, FROM Custom_Object__c];
  return customObject;
</pre>

The VF Code I am using is
<pre>
<apex:repeat var="object" value="{!customObject}">
  {!object.Owner.Name}
</apex:repeat>

Any help would be greatly appreciated.