• Vyacheslav Ramazanov 6
  • NEWBIE
  • 10 Points
  • Member since 2014

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

Hi all. Sorry for a dummy question :)
I am looking for possibility to control access to organization http ports (rest api).

Suppose I set a new app named "test_app", enable Oauth2 and pass the web server authentication flow (tokens). Now I can only add/remove oauth scopes. I wonder, but when I change it to the most strict (access basic information), test_app can still create objects.

The goal I wish to get is my org has a number of /services/arexrest/[port]'s to which I grand an access for external services. So how It can became real?

I will glad to see any answers and advises.

 

As I know there are three types of object fields in the salesforce: standard fields (text, formula, number ets.), lookups and generic fields (like WhatId and WhoId on Task). But yesterday I was asked about the Email and Phone fields on the Task object (setup -> custumize -> activities) and had troubles with the answer. I don't able to query them. Also one documentation (https://help.salesforce.com/HTViewHelpDoc?id=task_fields.htm&language=en_US) says they are exist, another says they aren't (https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_task.htm).

Where is the truth? :)

My org alredy have 800k+ Opportunities and OpportunityLineItems. I can see only opportunities records sum on data usage page. Why it doesn't count OpportunityLineItems?

Hi all. Sorry for a dummy question :)
I am looking for possibility to control access to organization http ports (rest api).

Suppose I set a new app named "test_app", enable Oauth2 and pass the web server authentication flow (tokens). Now I can only add/remove oauth scopes. I wonder, but when I change it to the most strict (access basic information), test_app can still create objects.

The goal I wish to get is my org has a number of /services/arexrest/[port]'s to which I grand an access for external services. So how It can became real?

I will glad to see any answers and advises.

 

My org alredy have 800k+ Opportunities and OpportunityLineItems. I can see only opportunities records sum on data usage page. Why it doesn't count OpportunityLineItems?
Hello,
I would like to send an email 15 hours every day.
I did the code, tested it, but I am not receiving email.
What should I do?

Thank you!

global class CSVTest implements System.Schedulable {
    public String mailSouhaite {get; set;}
    public string inputText {get; set;}
   
    global void execute(SchedulableContext sc) {
        planifier();
    }

 public void CSVTest(){
        planifier();
    }

public void newPlanifier (){
    String dailyCronExpression = '0 0 15 * * ?';
    System.schedule('test', dailyCronExpression, new CSVTest());    
    }
 
public void planifier(){
    String query=inputText;
    String premier=query.substringAfter('select ');
    premier=  premier.substringBefore('from');
   
    string titre= premier+'\n';
    string contenuCSV = titre;

    string queryResultatString = '';
    list<sObject> queryResultat = (List<sObject>)database.query(inputText);
    for(sObject a: queryResultat)
    {

        queryResultatString = queryResultatString + string.valueof(a);
    }

    list<string> queryLignes = queryResultatString.split('}');

    for(string s:queryLignes){
        list<string> queryColonnes = s.split(',');
        for(string st:queryColonnes){
            contenuCSV = contenuCSV + st.substringAfter('=') + ',';
        }
        contenuCSV = contenuCSV.substringBeforeLast(',').substringBeforeLast(',') + '\n';
    }
    String lignes = contenuCSV;
    List<String> parts = lignes.split('\n');
    integer lineNumber = queryResultat.size();
    integer nbLignesPJ = 50;
    integer compterParties=0;

    for(integer i=0;i<lineNumber;i++){

      string fichierParties = parts[0] + '\n';

      if(math.mod(i,nbLignesPJ)<>0) continue;
      if((lineNumber-i)<nbLignesPJ){
     
        for(integer j=1;j<=(lineNumber-i);j++){
            fichierParties = fichierParties + parts[i+j] + '\n';
        }
      }
      if((lineNumber-i)>=nbLignesPJ){
         for(integer j=1;j<=nbLignesPJ;j++){
            fichierParties = fichierParties + parts[i+j] + '\n';
        }
      }
      //Send Mail
      Messaging.EmailFileAttachment csvPJ = new Messaging.EmailFileAttachment();
      blob csvBlob = Blob.valueOf(fichierParties);
      string csvNom = 'cases_fermes_'+Date.today().format()+'.csv';
      csvPJ.setFileName(csvNom);
      csvPJ.setBody(csvBlob);
      Messaging.SingleEmailMessage email =new Messaging.SingleEmailMessage();
      String[] adressMail = new list<string> {mailSouhaite};
      compterParties++;
      String subject;
      if (compterParties >=2)
          subject = 'CSV - '+Date.today().format()+' - Partie '+compterParties;
      else
          subject = 'CSV - '+Date.today().format();
      email.setSubject(subject);
      email.setToAddresses(adressMail);
      email.setPlainTextBody('Mail....');
      email.setFileAttachments(new Messaging.EmailFileAttachment[]{csvPJ});
      Messaging.SendEmailResult [] envoyer = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});
    }
}
}

-------------------------------------------------------------------------------------------------------------------------

PAGE

<apex:page controller="CSVTest">
  <apex:form >
  <apex:PageBlock >
    :::::::::: TEST TEST TEST :::::::::: <br /><br />
    Mail..........:&nbsp;<apex:inputText styleClass="classeMail" value="{!mailSouhaite}"/><br /><br />
    Request  :&nbsp;&nbsp;<apex:inputText styleClass="classeRequete" value="{!inputText}"/><br /><br /> 
    <apex:commandButton value="SEND" action="{!newPlanifier}"/> <br/><br/>
   
  </apex:PageBlock>
  </apex:form>
</apex:page>

How can you we retrieve opportunities that was modified in last 15 mins without using apex code but via soql only,