• Pascal T
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

Hello,

 

I have an issue with a very simple java code on a button.

It is just updating a value on a picklist field. For some reason, it is not working with any profiles (administrator included). And no error message. It is just reloading the page and no change.

 

I seriously don't know where the problem could be coming from. It is working perfectly in the sandbox.

 

Here's the code.

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}

var sr = new sforce.SObject("Quote");
sr.Id = "{!Quote.Id}";
sr.Status = 'Accepted';
result = sforce.connection.update([sr]);

location.reload(true);

 

 

Hello,

 

In my test method it looks like there is no pricebook record I can use.

The following code returns the value 0 while I have 4 Pricebook records in my sandbox.

 

System.debug('There is '+[SELECT COUNT() FROM Pricebook2]+ ' Pricebook(s)');

 

 

Do I have to recreate all records in the test method in order to use them?

Hi,

 

I have a Custom Object Order.

I have am coding a Trigger to create an order automatically after an opportunity is won and I want to the order name to be automatically assigned the Synced quote number of the related opportunity.

 

Here's the code I have :

 

trigger test2 on Opportunity (after insert, after update) {

    for (Opportunity b : Trigger.new){
        List<Order__c> aa = [SELECT Id, Name FROM Order__c WHERE Opportunity__c = :b.Id];
        Integer i = aa.size();
        
        If (b.StageName == 'Closed Won' && i==0) {
        
        Order__c a = new Order__c();
        
        insert a;
        a.Name = b.SyncedQuote.QuoteNumber;
        a.Opportunity__c = b.Id;
        update a;
        }
    
    }
}

 

My issue is that the code in blue does not give me the Quote number but some Salesforce ID that I don't understand like "a02e0000001ivSG".

 

Can someone tell me how to get the quote number?

 

Hello,

 

I have an issue with a very simple java code on a button.

It is just updating a value on a picklist field. For some reason, it is not working with any profiles (administrator included). And no error message. It is just reloading the page and no change.

 

I seriously don't know where the problem could be coming from. It is working perfectly in the sandbox.

 

Here's the code.

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}

var sr = new sforce.SObject("Quote");
sr.Id = "{!Quote.Id}";
sr.Status = 'Accepted';
result = sforce.connection.update([sr]);

location.reload(true);

 

 

Hello,

 

In my test method it looks like there is no pricebook record I can use.

The following code returns the value 0 while I have 4 Pricebook records in my sandbox.

 

System.debug('There is '+[SELECT COUNT() FROM Pricebook2]+ ' Pricebook(s)');

 

 

Do I have to recreate all records in the test method in order to use them?