• Leticia Monteiro Freitas
  • NEWBIE
  • 70 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 8
    Replies
Hi, 

I'm trying to create a a trigger that complete my NumberCase based on my Recodtype. 

Ex:
I get two types of cases, External and Internal. When I create a External Case the Casenumber should be something like:
EX00001
EX00002
When goes Internal;
IN00001

Please anyone could help me ?
 
Hi, 

I'm trying to create a  visualforce page wich uploads a csv file for create a Pricebook and a pricebook entries. There is a funcitonality to update my pricebook from account that was informed on csv file. 
But when I upload the file - I get a message: List out Inboud : 1 and I dont know what to do. Please, can anyone suggest me something?

My Code:
Apex Class
/*Author: Leticia Freitas v1 - Data de Criação:04/07/2018
Carregar uma lista de preços por cliente via csv */

public class importDataFromCSVController {

public Blob csvFileBody{get;set;}
public string csvAsString{get;set;}
public String[] csvFileLines{get;set;}
public String[] csvBodyData{get;set;}

public List <pricebook2> headerList{get;set;} //header do catalogo de preços
public List <pricebookentry> bodyList{get;set;}// entradas de preços
PricebookEntry body = new PricebookEntry();
Product2 IdProduct;
Account  IdAccount;


 
public importDataFromCSVController(){
    csvFileLines = new String[]{};
    bodyList = New List <PricebookEntry>();
    headerList = New List <Pricebook2>();
   }
  

  public void importCSVFile(){
      
          /*Manipulação do arquivo para um string, por linha*/
          
           csvAsString = EncodingUtil.base64Encode(csvFileBody);
           csvFileLines = csvAsString.split('\n'); 
                      
           /*Lendo cabeçalho do catalogo de preços */
             Pricebook2 header = new Pricebook2 () ;
             string[] csvHeaderData = csvFileLines[1].split(';');
             header.name = csvHeaderData[1] ; 
             headerList.add(header);
             insert headerList; 
             
            
           
           /* Atualizar o campo pricebook*/
          
              Pricebook2 IDPrice = header;
              System.debug('Código conta'+ csvHeaderData[0]);
              try{
              IdAccount = [Select ID from Account where AccountNumber =: csvHeaderData[0]];
              IdAccount.Account_Pricebook__c =  IDPrice.id;
              Update IdAccount;
                   
              }catch (Exception A)
              {
                ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'Não tem conta vinculada');
                ApexPages.addMessage(errorMessage);
               }
             
               
           //lendo entrada da tabela de preços
           for(Integer i=3;i<csvFileLines.size();i++)
           {
            body.Pricebook2 = IDPrice; 
            csvBodyData = csvFileLines[i].split(';');
            IdProduct = [SELECT ProductCode FROM Product2 WHERE id =:csvBodyData[0]];
            body.Product2 = IdProduct;
            body.UnitPrice = Integer.valueOf(csvBodyData[1]);
            bodyList.add(body);
           }
           
        insert bodyList; 
        }
     }   
VF page:


//visualforce
<apex:page controller="importDataFromCSVController">
    <apex:form >
        <apex:pagemessages />
        <apex:pageBlock >
            <apex:pageBlockSection columns="2"> 
                  <apex:inputFile value="{!csvFileBody}"  filename="{!csvAsString}"/>
                  <apex:commandButton value="Importar Lista de Preços" action="{!importCSVFile}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
   </apex:form>
</apex:page>

Thank you :)
Hello, I'm trying to create a visualforce page which create a pricekbook from a excel file. 
My doubt is about how I can separate the header of pricebook (Name, account, etc) from de body (Products and prices). 
Can anyone help me?
 
Hello, 

I'm using the Order Object and create a discount field on my order item. 
When I gave a discount on item, I need that my Total Amount Field, on my Order, be updated. 
Is There anyway to update a standard formula field?

 
Hi, 

I'm Trying create an action for my Cases and when I select the action type Email, returns a message like this:
The Send Email action is off or activities are not allowed. Turn on the Email Email action and allow activities, then try again.
Hello, 

My objects Case has a tree types of register. One of the is called GIC. I need create a guide just for this type of register. 
Is it possible?
I want clean all the data in my org. How is the easiest way to do this?
When I create a case from a e-mail-to-case , how I can atach a file from my orign e-mail?
Hello, 

When I click on button Look Up field, I want that pop-up box show me all the register in that object, not just used recently.
Something like a list, with all my values. 

Can anyone could help with this?

It's something like this: My lookup field return me a search.
User-added image
 
Hello,

I've created a field in a Case object named Enviar para Laudo, but when I log on not as administrador my field doesnt show up. 

I've already changed the Security level and the Field Acessibility but still cant see the field.

Anyone, can help me?

 
Hello, 

I've created a workflow to send a email everytime a case was created. 
But my Workflow doesn't work, even I change the rules. 

Please, anyone know the reason? Is there some rule to workflow for cases?
User-added image
User-added image
 
I am creating a Case object and in it I have the invoice information, I  want automatically fill in the the Account field, according to the value of the invoice when a new case is created.
Can anyone help me? It's by some configure in the field or is it just work by triggers?

 
Hello, I'm trying to create a visualforce page which create a pricekbook from a excel file. 
My doubt is about how I can separate the header of pricebook (Name, account, etc) from de body (Products and prices). 
Can anyone help me?
 
Hello, 

I'm using the Order Object and create a discount field on my order item. 
When I gave a discount on item, I need that my Total Amount Field, on my Order, be updated. 
Is There anyway to update a standard formula field?

 
Hi, 

I'm Trying create an action for my Cases and when I select the action type Email, returns a message like this:
The Send Email action is off or activities are not allowed. Turn on the Email Email action and allow activities, then try again.
I want clean all the data in my org. How is the easiest way to do this?
When I create a case from a e-mail-to-case , how I can atach a file from my orign e-mail?
I am creating a Case object and in it I have the invoice information, I  want automatically fill in the the Account field, according to the value of the invoice when a new case is created.
Can anyone help me? It's by some configure in the field or is it just work by triggers?