• KS Kumaar
  • NEWBIE
  • 70 Points
  • Member since 2016
  • Mr

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 21
    Replies

I have a Vf page which display account object records. In this vf page each and every record have a button called Edit. If we click on Edit button it should be take us to detailed edit page respected record. For more clearance see my pictures which i uploded. 
User-added image
User-added image

To achive this process, I have developed following VF page.

<apex:page Controller="Redirect_Main2" action="{!Redirect_Main}">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a" >
                <apex:column value="{!a.Id}"/>
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Industry}"/>
                <apex:column id="two">
                    <apex:commandButton value=" Edit " onclick="window.open('/{!a.id}')" reRender="two"/>
<!--/e?retURL=%2F{!a.id}&_CONFIRMATIONTOKEN=VmpFPSxNakF4Tmkwd055MHlPVlF3T1Rvek5qb3dPQzQ0TnpaYSxvTFl3eklmdmNBcjl6RlVDeDRWUnBtLE9XWTJNbU01&common.udd.actions.ActionsUtilORIG_URI=%2F{!a.id}%2Fe')" reRender="two"/>
   -->             </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller:
public class Redirect_Main2 {

   public List<Account> accs { get; set; }
    public PageReference Redirect_Main(){
        accs = [select id,name,phone,Industry from account];       
        return null;
     }
}
 


But this is taking me to detailed page of the record but not edit page. Please tell me neccessary actions which i need to take.

Thanking you
KS Kumaar


I have a VF page which contains record id, name of account object and a button for each and every record as shown in image.User-added image
If i click the button for particular record, the respected record id should be displayed in same visualforce page. For that i created a class and VF page as given below.

VF Page:
<apex:page controller="one" action="{!save}">
    <apex:form >
        <apex:pageBlock id="one">
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.id}"/>
                <apex:column value="{!a.name}"/>
                <apex:column >
                    <apex:commandButton value="click" action="{!save}" reRender="one"/>
                    <apex:param assignTo="{!accid}" value="{!a.id}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>  
        ID:{!accid}
    </apex:form>
</apex:page>
Controller:
public class one{
    public string acName{set;get;}
    public integer acPhone{set;get;}
    public List<Account> accs{set;get;}
    public ID accid {set;get;}

    public pagereference save(){
        accs = [select id,name,phone,type from account limit 5];

        return null;
    }
}
I am unable to get this requirement. Could anyone please help me in this????
Thanking you
KS Kumaar
Let say we are performing on Account object

User-added image

On my visualforce page i have a button for each and every record as shown in image, on click of this button i want to open a pop up window. In whcih popup window should conatins account name and phone fields and save and cancel buttons only. Later by entering the values for account name and phone fields, if i click on save button, the values should be populated in perticular record(Should be modified in respected record). If i click on cancel button the popup window should be closed.

For this process, i tried several times with out success by using following code
<apex:page standardController="Account" recordSetVar="accs">
<script>
  function OpenVfpage(pid){
  var newwindow = window.open('/'+pid, 'name=_blank','height=500,width=500,left=250,top=100');
  newwindow.focus();
 }
</script>
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a" >
                <apex:column value="{!a.Id}"/>
                <apex:column value="{!a.name}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Industry}"/>
                <apex:column id="two">
                    <apex:commandButton value="Click" onclick="OpenVfpage('{!a.id}')" reRender="two"/>
               </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

This code is giving one popup window which conatins a detailed page of a record. but this is not reqiurement.

can you please share your thoughts along with code???

Thanking you 

KS Kumaar
User-added image

As the above page showing, If i click on the button, the corresponded output should be taken to respected detailed page. But it does not taking into respected output. I tried with following Controller and VF page.
Controller :
public class Redirect_Main1 {

   public List<Account> accs { get; set; }
   public ID aid;
    
    public void access(){
        accs = [select id,name,phone,Industry from account];
        for(Account acc:accs){
            aid = acc.id;
        }
        }
       public String getAccess2(){
         return 'https://ap2.salesforce.com/'+aid;
         }
   }
 
VF Page :
<apex:page Controller="Redirect_Main1" action="{!access}">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.Id}"/>
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Industry}"/>
                <apex:column >
                    <apex:commandButton value="Click" action="{!access}"/>
                        <apex:param name="account" assignTo="{!aid}" value="{!access2}"/>
               </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
I have tried maximum up to my best, but i could not get respected output. May be i think so, i committed wrong with <apex;param> component. Please let me know where i did mistake.
My task is I need to count number of times a record has been edited using Edit button after record has been created. For this I created a field called Edit_Counting__c (Number Type) and also created one workflow on MapTesting__c to get the count that record has been edited using ISCHANGED (Field Type).
Later I created one more field called Counting__c and I created this trigger, assigned Edit_counting__c with Counting__c (maap.Counting__c = maap.Edit_Counting__c+1).
I am getting my output by using Counting__c value, but its working for only one record when I click edit button for one record respectively. When I am trying to update more than one record using developer console, the Counting__c value does not effect to all the modified records.
I do not know where I have done mistake. I also post my code below. Please check it and please could anyone help in this?
Thanks in advance
KS Kumaar
trigger MapTesting_Editable on MapTesting__c(after update) { List<MapTesting__c> mmp = new List<MapTesting__c>(); List<MapTesting__c> mm = [select id, Edit_Counting__c, Counting__c from MapTesting__c where Id IN: Trigger.OldMap.keySet()]; if (RecusrssionTrigger.flag) { for (MapTesting__c maap: mm) { RecusrssionTrigger.flag = false; maap.Counting__c = maap.Edit_Counting__c + 1; mmp.add(maap); } update mmp; } }
Hi All,
I am new to SFDC. I want a trigger on an object. The developing scenario is given below.
The object is contains a custom pick list field called Status__c which contains pending, processing and Approved as a values.  After creating a record, if we want to change the status field value from approved to processing and pending, we need to get an error, as well as we need to get one more error while changing the status field value from processing to pending. But no error has to come, while value changing from pending to processing and approved, and processing to Approved.
Please can anyone provide the trigger with above scenario.

Thanks in advance
KS Kumaar
 
 

can we get bulk records for different objects at a time with out using rest resourse class using rest api GETmethod?
if it possible, please provide URI and Request body.
Thank you

KS Kumar

can we update bulk records by using patch or put method with out using rest sourse class?
if it is possible please let me know with URI and Request body?

Thank you 

KS Kumar

By providing following uri and by using following Request Body, we can insert a single in sObject 

uri: /services/data/v36.0/sobjects/sObject
Request Body : {
"field1" :"value1",
"field2" :"value2"
}
But, how to insert multiple records in an object using post method in workbench?
Could any one please suggest me.

Let consider an object has 10 fields and one more field called CountField. If I enter a value for field1 and if i save it, Then the CountField value should be updated with 1. Same like that if I enter value for field1 and field2, Then the CountField field value should be updated with 2. Even if i enter a values for field1, field3, field9 and field5, then the CountField should be updated with 4 . Like that i enter values for all fields, then countfield vlaue should be 10. Which means how many fields i entered values, the same value should be updated with CountField.
I have tried alot. but i could not get any logic. Please provide some solution

User-added imageUser-added image
Note: The value for countfield in image is entered by me manually. I want it automatically updated.

Thanks 
KS Kumar

I have a Vf page which display account object records. In this vf page each and every record have a button called Edit. If we click on Edit button it should be take us to detailed edit page respected record. For more clearance see my pictures which i uploded. 
User-added image
User-added image

To achive this process, I have developed following VF page.

<apex:page Controller="Redirect_Main2" action="{!Redirect_Main}">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a" >
                <apex:column value="{!a.Id}"/>
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Industry}"/>
                <apex:column id="two">
                    <apex:commandButton value=" Edit " onclick="window.open('/{!a.id}')" reRender="two"/>
<!--/e?retURL=%2F{!a.id}&_CONFIRMATIONTOKEN=VmpFPSxNakF4Tmkwd055MHlPVlF3T1Rvek5qb3dPQzQ0TnpaYSxvTFl3eklmdmNBcjl6RlVDeDRWUnBtLE9XWTJNbU01&common.udd.actions.ActionsUtilORIG_URI=%2F{!a.id}%2Fe')" reRender="two"/>
   -->             </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Controller:
public class Redirect_Main2 {

   public List<Account> accs { get; set; }
    public PageReference Redirect_Main(){
        accs = [select id,name,phone,Industry from account];       
        return null;
     }
}
 


But this is taking me to detailed page of the record but not edit page. Please tell me neccessary actions which i need to take.

Thanking you
KS Kumaar


I have a VF page which contains record id, name of account object and a button for each and every record as shown in image.User-added image
If i click the button for particular record, the respected record id should be displayed in same visualforce page. For that i created a class and VF page as given below.

VF Page:
<apex:page controller="one" action="{!save}">
    <apex:form >
        <apex:pageBlock id="one">
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.id}"/>
                <apex:column value="{!a.name}"/>
                <apex:column >
                    <apex:commandButton value="click" action="{!save}" reRender="one"/>
                    <apex:param assignTo="{!accid}" value="{!a.id}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>  
        ID:{!accid}
    </apex:form>
</apex:page>
Controller:
public class one{
    public string acName{set;get;}
    public integer acPhone{set;get;}
    public List<Account> accs{set;get;}
    public ID accid {set;get;}

    public pagereference save(){
        accs = [select id,name,phone,type from account limit 5];

        return null;
    }
}
I am unable to get this requirement. Could anyone please help me in this????
Thanking you
KS Kumaar
User-added image

As the above page showing, If i click on the button, the corresponded output should be taken to respected detailed page. But it does not taking into respected output. I tried with following Controller and VF page.
Controller :
public class Redirect_Main1 {

   public List<Account> accs { get; set; }
   public ID aid;
    
    public void access(){
        accs = [select id,name,phone,Industry from account];
        for(Account acc:accs){
            aid = acc.id;
        }
        }
       public String getAccess2(){
         return 'https://ap2.salesforce.com/'+aid;
         }
   }
 
VF Page :
<apex:page Controller="Redirect_Main1" action="{!access}">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable value="{!accs}" var="a">
                <apex:column value="{!a.Id}"/>
                <apex:column value="{!a.Name}"/>
                <apex:column value="{!a.Phone}"/>
                <apex:column value="{!a.Industry}"/>
                <apex:column >
                    <apex:commandButton value="Click" action="{!access}"/>
                        <apex:param name="account" assignTo="{!aid}" value="{!access2}"/>
               </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>
I have tried maximum up to my best, but i could not get respected output. May be i think so, i committed wrong with <apex;param> component. Please let me know where i did mistake.
My task is I need to count number of times a record has been edited using Edit button after record has been created. For this I created a field called Edit_Counting__c (Number Type) and also created one workflow on MapTesting__c to get the count that record has been edited using ISCHANGED (Field Type).
Later I created one more field called Counting__c and I created this trigger, assigned Edit_counting__c with Counting__c (maap.Counting__c = maap.Edit_Counting__c+1).
I am getting my output by using Counting__c value, but its working for only one record when I click edit button for one record respectively. When I am trying to update more than one record using developer console, the Counting__c value does not effect to all the modified records.
I do not know where I have done mistake. I also post my code below. Please check it and please could anyone help in this?
Thanks in advance
KS Kumaar
trigger MapTesting_Editable on MapTesting__c(after update) { List<MapTesting__c> mmp = new List<MapTesting__c>(); List<MapTesting__c> mm = [select id, Edit_Counting__c, Counting__c from MapTesting__c where Id IN: Trigger.OldMap.keySet()]; if (RecusrssionTrigger.flag) { for (MapTesting__c maap: mm) { RecusrssionTrigger.flag = false; maap.Counting__c = maap.Edit_Counting__c + 1; mmp.add(maap); } update mmp; } }
Hi All,
I am new to SFDC. I want a trigger on an object. The developing scenario is given below.
The object is contains a custom pick list field called Status__c which contains pending, processing and Approved as a values.  After creating a record, if we want to change the status field value from approved to processing and pending, we need to get an error, as well as we need to get one more error while changing the status field value from processing to pending. But no error has to come, while value changing from pending to processing and approved, and processing to Approved.
Please can anyone provide the trigger with above scenario.

Thanks in advance
KS Kumaar
 
 

By providing following uri and by using following Request Body, we can insert a single in sObject 

uri: /services/data/v36.0/sobjects/sObject
Request Body : {
"field1" :"value1",
"field2" :"value2"
}
But, how to insert multiple records in an object using post method in workbench?
Could any one please suggest me.

Let consider an object has 10 fields and one more field called CountField. If I enter a value for field1 and if i save it, Then the CountField value should be updated with 1. Same like that if I enter value for field1 and field2, Then the CountField field value should be updated with 2. Even if i enter a values for field1, field3, field9 and field5, then the CountField should be updated with 4 . Like that i enter values for all fields, then countfield vlaue should be 10. Which means how many fields i entered values, the same value should be updated with CountField.
I have tried alot. but i could not get any logic. Please provide some solution

User-added imageUser-added image
Note: The value for countfield in image is entered by me manually. I want it automatically updated.

Thanks 
KS Kumar