• rafaelburi
  • NEWBIE
  • 60 Points
  • Member since 2013

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

Hi there, 

I have copied some code online that you create a button i.e 'closed won' and create a field set to display the set of fields needed to be able to progress to the closed won stage. I'm wanting to do this for all stages. I was going to use Path but you are limited to 5 fields and theres many more than that needed at certain stages on the opportunity.

I have aded and followed the steps but is there a way of displaying the layout the same as lightening would? Currently this is what I get:

User-added image

This is the code:

<!-- Main information for the page including the "standardController" for the object (in this case, Opportunity) -->
<apex:page standardController="Opportunity" sidebar="true" showHeader="true" showChat="false" tabStyle="Opportunity" id="mainPage">
<!-- Show any error messages or validation rules -->
<apex:pageMessages ></apex:pageMessages>
<!--Start of the form -->
<apex:form id="mainForm" >
<!-- Showing the page block "standard" look and feel -->
<apex:pageBlock title="Required Fields for Opportunity Closed Won" id="mainBlock">
<!-- Start of the section -->
<apex:pageBlockSection columns="2" id="mainSection">
<!-- The Stage field and a call to the Javascript -->
<apex:inputField value="{!Opportunity.StageName}" rendered="true" required="true" id="stageName" onchange="checkStage();"/>
<!-- The values in the field set -->
<apex:repeat value="{!$ObjectType.Opportunity.FieldSets.Closed_Won_Required_Fields}" var="field">
<!-- Displaying the values through required input fields -->
<apex:inputField value="{!Opportunity[field]}" required="true" />
<!-- Closing the field set fields -->
</apex:repeat>
<!-- Adding the hidden field with CSS to not "display" the field in the page, even though the Javascript can "see" the field -->
<apex:inputField label="" id="cL" style="display:none;" value="{!Opportunity.Closed_Won_Required_Fields__c}"/>
<!-- Closing the page block section -->
</apex:pageBlockSection>
<!-- Start the page "buttons" from a normal page -->
<apex:pageBlockButtons >
<!-- Set the Save button -->
<apex:commandButton value="Closed Won" action="{!save}" />
<!-- Set the Cancel button -->
<apex:commandButton action="{!cancel}" value="Cancel"/>
<!-- Close the button section -->
</apex:pageBlockButtons>
<!-- Close the page block -->
</apex:pageBlock>
<!-- Close the form -->
</apex:form>
<!-- Start the Javascript checking the status for Qualified and updating it "onchange" -->
<script>
function checkStage(){
var s = document.getElementById("mainPage:mainForm:mainBlock:mainSection:stageName").value;
if(s == "Closed Won"){
document.getElementById("mainPage:mainForm:mainBlock:mainSection:cWRF").checked = true;
}
else {
document.getElementById("mainPage:mainForm:mainBlock:mainSection:cWRF").checked = false;
}
}
</script>
<!-- Close the Apex Page -->
</apex:page>
Any ideas? I'm not a deveoper, I just need a piece of code to enable this. Thanks in advance! 

Suzy
Hello erveryone,

I´m currently learning about the Wizard development with Visual force.
For this i´m using the Visualforce Developer Guide. But i´m stuck at this session: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_controller_getter_methods.htm
This is the error i get: System.QueryException: List has no rows for assignment to SObject
Class.MyController.getAccount: line 8, column 1

Apperently this means, that the querry in my controller returned nothing but i don´t know why since my code and makrup is identicle with the guid.

This ist the markup:
<apex:page controller="MyController" tabStyle="Account">
  <apex:pageBlock title="Hello {!$User.FirstName}!">
      This is your new page for the {!name} controller. <br/>
      You are viewing the {!account.name} account.
  </apex:pageBlock>
</apex:page>

This is the controller:
public class MyController {
    
    public string getName() {
        return 'MyController';
    }
    
    public Account getAccount() {
         return [select id, name from Account 
                 where id = :ApexPages.currentPage().getParameters().get('id')];
   }
}

I have a VF page witch use my custom object as standard controller.

When I add it in a page layout, I can see it in Desktop and SF1. However, when I add it via App Builder, It is not shown in SF1.

The VF contains the attribute lightningStylesheets="true" in page tag and the VF is enable for mobile app.

Does anyone know why this behavior ?

Thanks in advance.

Hi All.

 

Can someone help me this issue?

 

I have a map of OpportunityLineItem in my Controller Extension (the Standard Controller for the VF is Opportunity).

 

In my VF I have a table that is built iterating tru the map values, each cell has na inputField that references the Quantity field for the current OpportunityLineItem, those inputFields are rendered correctly, they show their values and so on...

 

The problem occur when I try to save some changes I had made with those values, the values inserted/changed are not being submitted.

 

Does anyone have any idea of how to solve it? 

 

Thanks in advance!

I have an Scheduler class witch invokes a batch class, my scheduler invokes System.abortJob to stop it is own execution, but most of these scheduled jobs still remain in Scheduled Jobs list.

 

Here is my scheduler class.

 

global class MyScheduler implements Schedulable {
   
   public Set<Id> olisIds {get; set;}
   
   global void execute(SchedulableContext ctx) {
		MyBatch batch = new MyBatch();
		batch.listOfIds = olisIds;
		Database.executeBatch(batch,100);
		System.abortJob(ctx.getTriggerId());
   }
   
}

The System methods documentation says the following about abortJob method:

Stops the specified job. The stopped job is still visible in the job queue in the Salesforce user interface.

 

But the accumulation of those scheduled jobs are causing an error and I am having to exclude them via interface.

 

Can anyone help me with it?

 

Thanks in advance.

Hi All.

 

Can anyone explain me the states of CronTrigger? The documentation only says the available states but it does not explain each of them.

 

WAITING
ACQUIRED
EXECUTING
COMPLETE
BLOCKED
ERROR
PAUSED
PAUSED_BLOCKED
DELETED

 

Thanks in advance.

Hi all.

 

I am trying to test a trigger that checks whether a Case is closed or not, but I can't close a Case in order to test my trigger.

I am doing the following in my test code.

 

Case parent = new Case();

Database.insert(parent);

 

Case child = new Case();

child.ParentId = parent.Id;

child.Status = 'Fechado'; // This label is set up to true in isClosed field in CaseStatus

Database.inset(child);

 

System.debug(child.Status); // It outputs Fechado

System.debug(child.isClosed); // It outputs false

 

Can someone help me? Sorry for my poor English.

Hi there, 

I have copied some code online that you create a button i.e 'closed won' and create a field set to display the set of fields needed to be able to progress to the closed won stage. I'm wanting to do this for all stages. I was going to use Path but you are limited to 5 fields and theres many more than that needed at certain stages on the opportunity.

I have aded and followed the steps but is there a way of displaying the layout the same as lightening would? Currently this is what I get:

User-added image

This is the code:

<!-- Main information for the page including the "standardController" for the object (in this case, Opportunity) -->
<apex:page standardController="Opportunity" sidebar="true" showHeader="true" showChat="false" tabStyle="Opportunity" id="mainPage">
<!-- Show any error messages or validation rules -->
<apex:pageMessages ></apex:pageMessages>
<!--Start of the form -->
<apex:form id="mainForm" >
<!-- Showing the page block "standard" look and feel -->
<apex:pageBlock title="Required Fields for Opportunity Closed Won" id="mainBlock">
<!-- Start of the section -->
<apex:pageBlockSection columns="2" id="mainSection">
<!-- The Stage field and a call to the Javascript -->
<apex:inputField value="{!Opportunity.StageName}" rendered="true" required="true" id="stageName" onchange="checkStage();"/>
<!-- The values in the field set -->
<apex:repeat value="{!$ObjectType.Opportunity.FieldSets.Closed_Won_Required_Fields}" var="field">
<!-- Displaying the values through required input fields -->
<apex:inputField value="{!Opportunity[field]}" required="true" />
<!-- Closing the field set fields -->
</apex:repeat>
<!-- Adding the hidden field with CSS to not "display" the field in the page, even though the Javascript can "see" the field -->
<apex:inputField label="" id="cL" style="display:none;" value="{!Opportunity.Closed_Won_Required_Fields__c}"/>
<!-- Closing the page block section -->
</apex:pageBlockSection>
<!-- Start the page "buttons" from a normal page -->
<apex:pageBlockButtons >
<!-- Set the Save button -->
<apex:commandButton value="Closed Won" action="{!save}" />
<!-- Set the Cancel button -->
<apex:commandButton action="{!cancel}" value="Cancel"/>
<!-- Close the button section -->
</apex:pageBlockButtons>
<!-- Close the page block -->
</apex:pageBlock>
<!-- Close the form -->
</apex:form>
<!-- Start the Javascript checking the status for Qualified and updating it "onchange" -->
<script>
function checkStage(){
var s = document.getElementById("mainPage:mainForm:mainBlock:mainSection:stageName").value;
if(s == "Closed Won"){
document.getElementById("mainPage:mainForm:mainBlock:mainSection:cWRF").checked = true;
}
else {
document.getElementById("mainPage:mainForm:mainBlock:mainSection:cWRF").checked = false;
}
}
</script>
<!-- Close the Apex Page -->
</apex:page>
Any ideas? I'm not a deveoper, I just need a piece of code to enable this. Thanks in advance! 

Suzy
Hello erveryone,

I´m currently learning about the Wizard development with Visual force.
For this i´m using the Visualforce Developer Guide. But i´m stuck at this session: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_controller_getter_methods.htm
This is the error i get: System.QueryException: List has no rows for assignment to SObject
Class.MyController.getAccount: line 8, column 1

Apperently this means, that the querry in my controller returned nothing but i don´t know why since my code and makrup is identicle with the guid.

This ist the markup:
<apex:page controller="MyController" tabStyle="Account">
  <apex:pageBlock title="Hello {!$User.FirstName}!">
      This is your new page for the {!name} controller. <br/>
      You are viewing the {!account.name} account.
  </apex:pageBlock>
</apex:page>

This is the controller:
public class MyController {
    
    public string getName() {
        return 'MyController';
    }
    
    public Account getAccount() {
         return [select id, name from Account 
                 where id = :ApexPages.currentPage().getParameters().get('id')];
   }
}

I have an Scheduler class witch invokes a batch class, my scheduler invokes System.abortJob to stop it is own execution, but most of these scheduled jobs still remain in Scheduled Jobs list.

 

Here is my scheduler class.

 

global class MyScheduler implements Schedulable {
   
   public Set<Id> olisIds {get; set;}
   
   global void execute(SchedulableContext ctx) {
		MyBatch batch = new MyBatch();
		batch.listOfIds = olisIds;
		Database.executeBatch(batch,100);
		System.abortJob(ctx.getTriggerId());
   }
   
}

The System methods documentation says the following about abortJob method:

Stops the specified job. The stopped job is still visible in the job queue in the Salesforce user interface.

 

But the accumulation of those scheduled jobs are causing an error and I am having to exclude them via interface.

 

Can anyone help me with it?

 

Thanks in advance.

Hi all.

 

I am trying to test a trigger that checks whether a Case is closed or not, but I can't close a Case in order to test my trigger.

I am doing the following in my test code.

 

Case parent = new Case();

Database.insert(parent);

 

Case child = new Case();

child.ParentId = parent.Id;

child.Status = 'Fechado'; // This label is set up to true in isClosed field in CaseStatus

Database.inset(child);

 

System.debug(child.Status); // It outputs Fechado

System.debug(child.isClosed); // It outputs false

 

Can someone help me? Sorry for my poor English.