• Timothy Gentet O'Brien
  • NEWBIE
  • 49 Points
  • Member since 2014
  • Salesforce Technical Consultant
  • EMPAUA

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 23
    Replies
Hi Friends,

                  I am geeting the following issue when i try to check the syntax error on onclick javascript button. "Syntax error &". in the following code. Can any one please help me resolving this issue.
Code:
{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")} 
try 


var partnerType; 
var accList = []; 
var result = sforce.connection.query( 
"Select Id, Name,Account__c,RecordType.Name,Account__r.Partner_Type_New__c FROM custom_c where id='{!custom__c.Id}' "); 
var iter = new sforce.QueryResultIterator(result); 

while(iter.hasNext()) 

var record=iter.next(); 
partnerType = record.RecordType.Name;
accList.push(record.Account__c); 

if(partnerType=='customer') 

sforce.apex.execute("SampleClass","sampleMethod1",{refreshAccList:accList}); 
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}"; 
}
else if(partnerType =='newcustomer'){ 
sforce.apex.execute("Sampleclass1","sampleMethod",{refAccList:accList}); 
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}"; 
}

catch(err){ 
alert(err); 
alert("System is currently unable to process your request."); 
}
My company has decided to move entire metadata and data to new org.(Due to some reasons)
So i am trying to start with that.Apart from data,we are having apps,installed packages,std objects,custom objects,community, and many more

So where should i start with?what should i transport first?
Any pointers please.
I have been messing around with the LWC OSS Components (https://lwc.dev/)... 

But I am a little lost, I assumed there would have been a straight forward way of retrieving data from a DB or even from Salesforce...

I wanted to use something like Passport along with Mongoose (NodeJS modules), to authenticate then to retrieve data from a MongoDB, to then display stuff out there... but I can't seem to get this to work and I can't find any info online about this yet either :/
I have been messing around with the LWC OSS Components (https://lwc.dev/)... 

But I am a little lost, I assumed there would have been a straight forward way of retrieving data from a DB or even from Salesforce...

I wanted to use something like Passport along with Mongoose (NodeJS modules), to authenticate then to retrieve data from a MongoDB, to then display stuff out there... but I can't seem to get this to work and I can't find any info online about this yet either :/
Hi,

I am trying to call a REST service on Salesforce from Phyton and I keep on getting a message: Invalid session ID.
Can anyone help here?
How do I get a session ID?

Thanks,
Hadas

Hi,
I am wiritng code for custom button JavaScript Onclick funcitonality.
Scernario :when i click Custom button,  it should display warning message as 'No Inovice is created' provided when invoice is not created in   Quick action of this page'. Than  user is given two choices , Pop up mesage opens 
i) user can ignore the above message  and Click ignore  and then  clik the final  submit button on the page.
ii) user shd click Ok  and create the Invocie number from the quick action and then click the final  submit button.
So far i was able to create lighetning component 'Submit Button' with aura component. 
Note:Enter funtionality shd work on lighetning page only.

the above funtionality in classic am aware .But using javascript functionality on lighetihng is something very new to me.
Any help would be appreciated.

 

Thanks in advance

 

Hi Friends,

                  I am geeting the following issue when i try to check the syntax error on onclick javascript button. "Syntax error &". in the following code. Can any one please help me resolving this issue.
Code:
{!REQUIRESCRIPT("/soap/ajax/38.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/38.0/apex.js")} 
try 


var partnerType; 
var accList = []; 
var result = sforce.connection.query( 
"Select Id, Name,Account__c,RecordType.Name,Account__r.Partner_Type_New__c FROM custom_c where id='{!custom__c.Id}' "); 
var iter = new sforce.QueryResultIterator(result); 

while(iter.hasNext()) 

var record=iter.next(); 
partnerType = record.RecordType.Name;
accList.push(record.Account__c); 

if(partnerType=='customer') 

sforce.apex.execute("SampleClass","sampleMethod1",{refreshAccList:accList}); 
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}"; 
}
else if(partnerType =='newcustomer'){ 
sforce.apex.execute("Sampleclass1","sampleMethod",{refAccList:accList}); 
parent.window.location = "{! URLFOR($Action.custom__c.View,custom__c.Id,null)}"; 
}

catch(err){ 
alert(err); 
alert("System is currently unable to process your request."); 
}
My company has decided to move entire metadata and data to new org.(Due to some reasons)
So i am trying to start with that.Apart from data,we are having apps,installed packages,std objects,custom objects,community, and many more

So where should i start with?what should i transport first?
Any pointers please.
I have a user who is able to view and edit the fields in salesforce via a permission set, however the SOQL query fails unless FLS is enabled, claiming those fields are missing.
How can we track case status timing 
1. Every time case status got changed 
2. If case status is changed to previous also add to previous time
Ex : case status - assigned to working at 11:00 to 12:00 (changed to working) under assigned 1hr
12:00 to 1:00 (changed to assign )
Need to show 
Working as 1hr and assigned as 2hrs

How can we achieve it ?

Thanks for advance
 
I am trying to complete the Create a lightning component on Trailhead, I keep getting this error I cannot understand what I have missed. Can anyone help?
Failed to save MyContactList.cmp: 0Ad7F000000f3e5:15,18: ParseError at [row,col]:[16,18] Message: XML document structures must start and end within the same entity.: Source

This is my code as per the module 
<aura:component controller="MyContactListController" implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" >
<aura:attribute name="recordId" type="Id" />
<aura:attribute name="Account" type="Account" />
<aura:attribute name="Contacts" type="Contact" />
<aura:attribute name="Columns" type="List" />

<force:recordData aura:id="accountRecord"
                  recordId="{!v.recordId}"
                  targetFields="{!v.Account}"
                  layoutType="FULL"
                  />

<lightning:card iconName="standard:contact" title="{! 'Contact List for ' + v.Account.Name}">
    <!-- Contact list goes here -->
</lightning:card>
On the ''ACCOUNTS'', I am trying to hide one of the ''TYPE'' available for all who are not administrators...When I add new accounts, some are in a category (ex: distributor) I want to make invisible for specific users...who are distributors :) Thank you for your help
I'm issuing the following query via the force.com cli:

force query "select masterlabel, id, lastModifiedBy.Name, lastModifiedDate, createdBy.Name, createdDate, VersionNumber, Status, ProcessType, Description from Flow" --format:csv tooling > file.csv

My typical result is a csv file with the following column headers:
CreatedBy.Name, CreatedDate, Description, Id, LastModifiedBy.Name, LastModifiedDate, MasterLabel, ProcessType, Status, VersionNumber

However, some orgs return a file with two extra columns (CreatedBy and LastModifiedBy) both of which contain no values:
CreatedBy, CreatedBy.Name, CreatedDate, Description, Id, LastModifiedBy, LastModifiedBy.Name, LastModifiedDate, MasterLabel, ProcessType, Status, VersionNumber

Any ideas what would cause this behavior?
Hi all, i am getting this error in my Test class:

System.DmlException: Insert failed. First exception on row 0; first error: OP_WITH_INVALID_USER_TYPE_EXCEPTION, Operation not valid for this user type: []

Don't know how to solve this? Any help would be rally helpful

Scenario: updating the opp owner based on the product owner from account

@isTest
    public static void testhandleCorporateSalesBeforeInsert() {
        
        Id rTDCXX = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('CDC').getRecordTypeId();
        Id rTPCTX = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('CSP').getRecordTypeId();
           Test.startTest();
        List<Custom_Setopp__c> oppownerList = new List<Custom_Setopp__c>();
        Custom_Setopp__c Products1 = new Custom_Setopp__c(Name = 'DC', Record_Type__c = 'CDC', 
                                                                PTC__c = 'DC');
        oppownerList.add(Products1);
        Custom_Setopp__c Products2 = new Custom_Setopp__c(Name = 'Paty', Record_Type__c = 'CSP', 
                                                                PTC__c = 'PAY');
        oppownerList.add(Products2);
        insert oppownerList;
        
        Profile p = [select id from profile where name='Standard User'];
        RecordType rt = [select id from recordtype where sobjecttype = 'Opportunity' and name = 'CDC'];
        User u = new User(alias = 'standt', email='testuser@test.com',
                          emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
                          localesidkey='en_US', profileid = p.Id, employeenumber = 'A000000',
                          timezonesidkey='America/Los_Angeles', username='testuser737712@test.com', IsActive = true);
        insert u;          
        
        System.runAs (u) {
            UserRole r = new UserRole(Name='ACCROL');      
            insert r;
        
        Account account = new Account(Name='Test Account',Type='PS',CSG_Account_stat__c='PROSPECT',OwnerId=u.Id,BillingStreet='123 Main',BillingCity='Co',BillingState = 'CA',BillingPostalCode='67890',Phone='123-456-7890');
        insert account;
        system.debug('in test account id ::'+account.Id);
            
        List<Employee__c> empList = new List<Employee__c>();
        Employee__c Employee1 = new Employee__c(Name='Testing1', Employee_Number__c='A000000', Email__c='testuser@test.com', User__c = u.Id);
        empList.add(Employee1);
        insert empList;
        system.debug('empList::'+empList);
            
        List<Prod__c> prodList = new List<Prod__c>();
        Prod__c product1 = new Prod__c(Name='DC - Test Account',PC__c = 'DC',Account__c = account.Id, 
                                                         stat__c = 'Prospect', Owner__c = Employee1.Id, AE__c = Employee1.Id);
        prodList.add(product1);
        Prod__c product2 = new Prod__c(Name='PAY - Test Account',PC__c = 'PAY',Account__c = account.Id,
                                                         stat__c = 'Prospect', Owner__c = Employee1.Id);
        prodList.add(product2); 
        insert prodList;
        
        system.debug('in test prodList id ::'+prodList);
        
        List<Opportunity> oppList = new List<Opportunity>();
        Opportunity opp1 = new Opportunity(AccountId = account.id, Name = 'Test DC', Type = 'Conversion', 
                                          Consultant_Advisor__c = 'Yes', StageName = 'LGC - 0%',
                                           CloseDate = System.today(), RecordTypeId = rTDCX);
        oppList.add(opp1);
        Opportunity opp2 = new Opportunity(AccountId = account.id, Name = 'Test DC', Type = 'Conversion',
                                           Consultant_Advisor__c = 'Yes', StageName = 'LGC - 0%', 
                                           CloseDate = System.today(), RecordTypeId = rTPCTX);
        oppList.add(opp2);
        insert oppList;
        system.debug('oppList[0].OwnerId ::'+oppList[0].OwnerId);
        //System.assertEquals(Userinfo.getUserId(), oppList[0].OwnerId);
        
        Test.stopTest();
    }
  }

Actual Class:

public void HSCBI(Opportunity[] opportunities) {
        // Find all CDC opportunities
        Set<Id> accountIds = new Set<Id>();
        List<Opportunity> csopp = new List<Opportunity>();
        Map<String,String> prt = new Map<String,String>();
        Map<String,String> rtwp = new Map<String,String>();
        
        for(Custom_Setopp__c csRec : Custom_Setopp__c.getall().values() ){
            prt.put(csRec.Record_Type__c,csRec.Product_Type__c);
            rtwp.put(csRec.Product_Type__c,csRec.Record_Type__c);
        }
        
        for (Opportunity opportunity : opportunities) {
            Schema.RecordTypeInfo rt = rtMap.get(opportunity.RecordTypeId);
            if (rt != null && prt.containsKey(rt.getName()) ){ 
                accountIds.add(opportunity.AccountId);
                csopp.add(opportunity);
            }
        }
        
        // If no CS opportunities found then discontinue processing
        if (csopp.isEmpty())
            return;
        
        Map<Id,Map<String,Id>> acpto = new Map<Id,Map<String,Id>>();
        system.debug('accountIds::'+accountIds+'\nprt.values()::'+prt.values());
        List<Prod__c> pl= [SELECT Id, PC__c,Owner__c, Account__c,Owner__r.User__c 
                                      FROM Prod__c ];
         system.debug('pl::'+pl);
        for (Prod__c prod : [SELECT Id, PC__c,Owner__c, Account__c,Owner__r.User__c 
                                      FROM Prod__c 
                                      WHERE Account__c in : accountIds AND PC__c in :prt.values() AND Owner__r.User__c != null]){
                       
             Map<String,Id> Pom = new Map<String,Id>();
             
             if(acpto.containsKey(prod.Account__c)){
                Pom = acpto.get(prod.Account__c);
             }
             Pom.put(rtwp.get(prod.PC__c),prod.Owner__r.User__c);
             acpto.put(prod.Account__c,Pom);
             system.debug('owner::'+acpto.values()+'\nPom.values()::'+Pom.values());
           }
         
        // For new CS* opportunities, auto transfer owner to product owner 
        for (Opportunity opportunity : csopp) { 
            if (opportunity.StageName != null) {
                Schema.RecordTypeInfo rt = rtMap.get(opportunity.RecordTypeId);
                                
                if(acpto.containsKey(opportunity.AccountId) && 
                    acpto.get(opportunity.AccountId).containsKey(rt.getName()) ){
                    opportunity.OwnerId = acpto.get(opportunity.AccountId).get(rt.getName()) ;
                }
            }
        } 
    }
Is there any certification process for applications that use Salesforce from outside through REST API (i.e. no Apex code)?
Hello!
I have problem with objects which have the same api name(one of objects is contained in Recycle Bin another one deployed). I want to get full information(like namespace, id, etc) for objects(not records for this objects) which are deployed. 
Hi Gurus, 

I have this Javascript code that is suppose to save a form on to my custom object is Salesforce and then redirect the user to my second visualforce page, which is a "ÿou have successfully saved the form" page. 

However when I add the code to my VF page, the form doesnt save or get redirected.

Please if someone knows what is wrong with the code, please let me know.



My code for the save and redirection to second page:

<apex:actionFunction name="savefromJS" action="{!save}" />


<script>
    function saverecordandredirect(){
       savefromJS();
       window.location('/apex/ThankYouPage');
    }
</script>


<apex:commandButton value="Save it" onclick="saveandredirtect() ;"/>


 
Hi all ,
I am confused about veiwstate thing in lightnign and why don't we need that in lightning.how do lightning maintain state of variables in page?

I Have requirement in which i need to send a email to a public group from an apex class.

 

Any pointers will be helpful

 

Thanks in advance  

  • October 20, 2009
  • Like
  • 0
Hi all ,
I am confused about veiwstate thing in lightnign and why don't we need that in lightning.how do lightning maintain state of variables in page?