• atulajawale
  • NEWBIE
  • 0 Points
  • Member since 2010
  • Salesforce Consultant

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

Hello ,

 

I am trying to create a chatter posts with @mentions from REST API but want to post these chatter with a different user and not as logged in user for REST API , Can this be possible I know we can do this using apex code by setting CreatedById but @mentions are not possible through APEx hence I am using rest api from salesforce. Please let me know if anybody has any solution for this ?

 

Thanks and Regards,

Atul

Hello All,

 

We can share a file posted on the chatter using GUI to a user , I am trying to achive the same in apex but not getting which object stores that information . ContentVersion is the object stores file but where how the sharing is stored ?

 

Regards,

Atul

Hi All,

 

I am working on a task to customize the home page where I want to change the css for each home page component (different for each component).  Can we use a standard home page component say search in a visualforce page?

 

Or any other way to accomplish this will also help me.

 

 

Thanks and Regards,

 

Atul

HI Friends,

 

I am new to salesforce..i have a doubt that, is it possible to integrate the salesforce organization to salesforce organization using RestFull API? we have a option in salesforce like salesforce o salesforce but i just want to implement this using RestFull API,Pease help me.

 

Regards

Reddy

Hello ,

 

I am trying to create a chatter posts with @mentions from REST API but want to post these chatter with a different user and not as logged in user for REST API , Can this be possible I know we can do this using apex code by setting CreatedById but @mentions are not possible through APEx hence I am using rest api from salesforce. Please let me know if anybody has any solution for this ?

 

Thanks and Regards,

Atul

Hi All,

 

 I have written a query in a batch apex. It was working correctlt until i added

 Date_Opened__c>(today -(5*Average_Sales_Cycle__c)).   It is giving an error  "First error: unexpected token: '(' " when i run the batch apex.

 

Please let me know what is the right way to query a date field (Date_Opened__c) which meet the above criteria.



 

q= 'Select id, name,StageVFlag__c, StageBFlag__c,StageAFlag__c,StageEFlag__c,StageCFlag__c,StageGFlag__c,ownerid, status__c, type, amount,  from opportunity where  (amount>=0.00 and amount<=100000.00) and Date_Opened__c>(today -(5*Average_Sales_Cycle__c)) and type =\'Non-Recurring\'';}

 

Thanks

  • January 25, 2012
  • Like
  • 0

Hi All

 

I have the following code and i am not able to test IF Condition in my code.

 

Here is my class and test class so far

global class updateOpportunityStage implements Database.Batchable<sObject>,Schedulable{
global string query ;

global updateOpportunityStage(){

Query = 'Select Id,BigMachines__Status__c,BigMachines__Is_Primary__c,BigMachines__Opportunity__c    from BigMachines__Quote__c where BigMachines__Is_Primary__c = true and BigMachines__Status__c like \'%unison%\' ';

}

global database.querylocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);    
}
    global void execute(SchedulableContext SC){
        integer bSize;
        integer Interval;
        try{
            Apex_Jobs_Settings__c aJob = [select id, name, batch_size__c, Run_Schedule_Interval__c, Isactive__c from Apex_Jobs_Settings__c where name = 'ContactsMerge' limit 1];
            if( aJob.IsActive__c = true){
                bSize = integer.valueOf(aJob.Batch_Size__c);
                Interval = integer.valueOf(aJob.Run_Schedule_Interval__c);
            }  
            else{
      
      
            }
        }
        catch(Exception ex){
        system.debug('ERROR: '+ ex);
        bSize=150;
        interval = 30;
    }    
        updateOpportunityStage stg = new updateOpportunityStage();
        DateTime todayMin = Datetime.now();
        DateTime today = todayMin.addMinutes(Interval);
        
        String seconds = '0';
        Integer minutes = today.minute();
        Integer hours = today.hour(); 
        Integer dayOfMonth = today.day(); 
        Integer month = today.month(); 
        Integer milisec = today.millisecond();
        String dayOfWeek = '?'; 
        Integer year = today.year(); 

        String sch = seconds + ' ' + minutes + ' ' + hours + ' ' + dayOfMonth + ' ' + month + ' ' + dayOfWeek + ' ' + year;
     
        String j = 'New Job:'+hours+':'+minutes+':'+seconds+':'+milisec;

        system.schedule(j, sch, stg);
       
        database.executebatch(stg, bSize);
        
     }

global void execute(Database.BatchableContext BC, List<sObject> scope){

     
    Set<id> liOppIds = new Set<id>();

for(sObject s : scope){

BigMachines__Quote__c quote = (BigMachines__Quote__c)s;
System.debug('Adil'+quote);
if(quote.BigMachines__Status__c.contains('Unison') && quote.BigMachines__Is_Primary__c == true)
liOppIds.add(quote.BigMachines__Opportunity__c);

}


//query all the opportunities in a single query
List<Opportunity> opp = new List<Opportunity>();
opp = [select id, StageName from Opportunity where id in :liOppIds and stagename != 'Closed Won' and  CloseDate >= Today];
for ( Opportunity opps : opp)
{
opps.StageName = 'Closed Won' ; 
}
//update all opportunities in a single DML
if(opp.size() > 0)
update opp;
 
    }
  global void finish(Database.BatchableContext BC){}  

}

 Test class is as follows

 

@isTest

Private class updateOpportunityStage_Test
{
static testMethod void Testclass(){

Opportunity Opp = new Opportunity(Name = 'Test',StageName = 'Closed Won',CloseDate= date.today());

insert opp;



BigMachines__Quote__c bmq = new BigMachines__Quote__c(BigMachines__Status__c = '%Unison%');

insert bmq;
  Apex_Jobs_Settings__c aJob = new   Apex_Jobs_Settings__c(Name ='test',batch_size__c=150,Run_Schedule_Interval__c=30,Isactive__c=true);

insert ajob;



  Test.startTest();  
// Schedule the job
            updateOpportunityStage stg = new updateOpportunityStage();

        
        ID batchprocessid = Database.executeBatch(stg,150);
              updateOpportunityStage stg1 = new updateOpportunityStage();
   String sch = '0 0 6 13 2 ?';        
     system.schedule('Schedule Test', sch, stg1);
 Test.stopTest();

}


}

 Thanks

Adil