-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
60Questions
-
66Replies
how to pass accountid to child compnent to display modal with related contactlist when a user clicks button on parent component
Child component is working fine , but unable to pass parentid to child component. Please help me
Parent component:
Parent component:
- <aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:appHostable" access="global" >
- <aura:attribute name="accounts" type="account[]"/>
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- <aura:attribute name="selectedId" type="string"/>
- <aura:attribute name="isTrue" type="account" default="false"/>
- <table class="slds-table slds-table--bordered">
- <tr>
- <td> Name </td>
- <td> Industry </td>
- <td> Phone</td>
- <td> CreatedDate</td>
- <td> ContactList Button</td>
- </tr> <b/>
- <aura:iteration items="{!v.accounts}" var="accs1" >
- <tr>
- <td> {!accs1.Name} </td>
- <td> {!accs1.Industry} </td>
- <td> {!accs1.Phone} </td>
- <td> {!accs1.CreatedDate}</td>
- <td>
- <lightning:button value="{!accs1.Id}" variant="neutral" label="ContactList" onclick="{! c.handleClick }" />
- </td>
- </tr><b/>
- </aura:iteration>
- </table >
- <c:DisplayAccountswithContactsNested1 aura:id="compB" selectedAccount="{!v.selectedId}"/>
- </aura:component>
- ({
- doInit : function(component, event, helper) {
- var action =component.get("c.getAllAccounts");
- console.log('The action value is: '+action);
- action.setCallback(this, function(a){
- component.set("v.accounts", a.getReturnValue());
- // console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- });
- $A.enqueueAction(action);
- },
- handleClick : function(component, event, helper) {
- var accId = event.getSource().get("v.value");
- component.set("v.selectedId",accId);
- },
- })
- <aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes,force:hasRecordId,force:appHostable" access="global" >
- <aura:attribute name="selectedAccount" type="string" />
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- <aura:attribute name="contacts" type="contact[]"/>
- <aura:attribute name="isOpen" type="boolean" default="false"/>
- <aura:attribute name="showSpinner" type="boolean" default="false"/>
- <div class="slds-m-around--xx-large">
- <lightning:spinner variant="brand" size="large" class="{!if(v.showSpinner,'slds-show','slds-hide')}"/>
- <aura:if isTrue="{!v.isOpen}">
- <div class="demo-only" style="height: 640px;">
- <div role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_large slds-list-builder" aria-labelledby="id-of-modalheader-h2" aria-modal="true" aria-describedby="modal-content-id-1">
- <div class="slds-modal__container">
- <div class="slds-modal__header" >
- <p class="conList">Contact List</p>
- </div>
- <div class="slds-modal__content slds-p-around_medium" >
- <table class="slds-table slds-table--bordered" >
- <thead>
- <tr class="slds-text-heading--label">
- <th class="slds-cell-shrink">
- <label class="slds-checkbox">
- <input type="checkbox" name="options" />
- <span class="slds-checkbox--faux"></span>
- <span class="slds-assistive-text">Select All</span>
- </label>
- </th>
- <td>ContacFirstName</td>
- <td>Phone</td>
- <td>CreatedDate</td>
- </tr>
- </thead>
- <aura:iteration items="{!v.contacts}" var="cons" >
- <tbody>
- <tr class="slds-hint-parent">
- <td class="slds-cell-shrink" data-label="Select Row">
- <label class="slds-checkbox">
- <input type="checkbox" name="options" />
- <span class="slds-checkbox--faux"></span>
- <span class="slds-assistive-text">Select Row</span>
- </label>
- </td>
- <td>
- <a
- href="{!'/one/one.app?#/sObject/'+ cons.Id + '/view'}"
- target="_blank">
- {!cons.FirstName}
- </a>
- </td>
- <td> {!cons.Email} </td>
- <td> {!cons.Phone} </td>
- <td> {!cons.CreatedDate}</td>
- </tr>
- </tbody>
- </aura:iteration>
- </table>
- </div>
- <div class="slds-modal__footer">
- <lightning:button variant="neutral" label="Close" onclick="{! c.closeModel }"/>
- <lightning:button variant="neutral" label="LikenClose" onclick="{! c.likenClose }" />
- </div>
- </div>
- </div>
- </div>
- <div class="slds-backdrop slds-backdrop_open"></div>
- </aura:if>
- </div>
- </aura:component>
- ({
- doInit : function(component, event, helper) {
- component.set("v.showSpinner",true);
- var accId = component.get("v.selectedAccount");
- var action = component.get("c.getAllContacts");
- action.setParams({
- "ParentId": accId
- });
- action.setCallback(this, function(response){
- var state = response.getState();
- if (component.isValid() && state === "SUCCESS"){
- $A.log(response);
- component.set("v.contacts", response.getReturnValue());
- }
- else {
- console.log("Failed with state" + state);
- }
- component.set("v.showSpinner",false);
- })
- $A.enqueueAction(action);
- component.set("v.isOpen", true); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- },
- closeModel: function(component, event, helper) {
- component.set("v.isOpen", false); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- },
- likenClose: function(component, event, helper) {
- alert('thanks for like Us :)');// Display alert message on the click on the "Like and Close" button from Model Footer
- // and set set the "isOpen" attribute to "False for close the model Box.
- component.set("v.isOpen", false);
- },
- })
- <aura:application extends="force:slds" >
- <!--<c:DisplayAccountswithContactsNested1 selectedAccount="0012800000C7F3zAAF"/> -->
- <c:displayAccountsWithContacts />
- </aura:application>
- Apex class:
- public class accountsWithContactsClass {
- @auraEnabled
- public static list<account> getAllAccounts()
- {
- list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
- return accs;
- }
- @auraEnabled
- public static list<contact> getAllContacts(String ParentId)
- {
- list<contact> cons = [select id,firstname,phone,CreatedDate,Email,accountid,account.name from contact where accountid =: ParentId];
- return cons;
- }
- }
-
- tulasiram ch
- November 13, 2017
- Like
- 0
- Continue reading or reply
how to pass accountid to popup window for displaying related contactList in lightning
I used following component and controller with apex class: But i am knew to lightning, Please help me how to display related contactlist with accountid in new window...
DisplayAccountsWithContacts.cmp:
public class accountsWithContactsClass {
@auraEnabled
public static list<account> getAllAccounts()
{
list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
return accs;
}
}
===================================================================================================

DisplayAccountsWithContacts.cmp:
- <aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes" access="global">
- <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
- <aura:attribute name="accounts" type="account[]"/>
- <table>
- <tr>
- <td> Name </td>
- <td> Industry </td>
- <td> Phone</td>
- <td> CreatedDate</td>
- <td> ContactList Button</td>
- </tr> <b/>
- <aura:iteration items="{!v.accounts}" var="accs1" >
- <tr>
- <td> {!accs1.Name} </td>
- <td> {!accs1.Industry} </td>
- <td> {!accs1.Phone} </td>
- <td> {!accs1.CreatedDate}</td>
- <td> <lightning:button variant="neutral" label="ContactList" onclick="{! c.handleClick }" />
- </td>
- </tr><b/>
- </aura:iteration>
- </table>
- <aura:attribute name="isOpen" type="boolean" default="false"/>
- <div class="slds-m-around--xx-large">
- <aura:if isTrue="{!v.isOpen}">
- <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
- <div class="slds-modal__container">
- <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
- <div class="slds-modal__header">
- <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2 id="header99" class="slds-text-heading--medium">ContactList</h2>
- <!--###### MODAL BOX FOOTER Part Start From Here ######-->
- <div class="slds-modal__footer">
- <button class="slds-button slds-button--neutral" onclick="{!c.closeModel}" >Cancel</button>
- <button class="slds-button slds-button--brand" onclick="{!c.likenClose}">Like and Close</button>
- </div>
- </div>
- </div>
- </div>
- </aura:if>
- </div>
- </aura:component>
- ({
- myAction : function(component, event, helper) {
- var action =component.get("c.getAllAccounts");
- console.log('The action value is: '+action);
- action.setCallback(this, function(a){
- component.set("v.accounts", a.getReturnValue());
- // console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- });
- $A.enqueueAction(action);
- },
- handleClick : function(component, event, helper) {
- component.set("v.isOpen", true); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- } ,
- closeModel: function(component, event, helper) {
- component.set("v.isOpen", false); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- },
- likenClose: function(component, event, helper) {
- alert('thanks for like Us :)');// Display alert message on the click on the "Like and Close" button from Model Footer
- // and set set the "isOpen" attribute to "False for close the model Box.
- component.set("v.isOpen", false);
- },
- })
public class accountsWithContactsClass {
@auraEnabled
public static list<account> getAllAccounts()
{
list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
return accs;
}
}
===================================================================================================
-
- tulasiram ch
- September 11, 2017
- Like
- 0
- Continue reading or reply
I have used lightning component in visualforce page. I got this code from one of the website. But flipcard background color is not working please help me...
App:
- <aura:application access="global" extends="ltng:outApp">
- <aura:dependency resource="c:flipCard" />
- </aura:application>
- <aura:component >
- <aura:attribute type="string" name="bgColor" />
- <aura:attribute type="string" name="fontColor" default="#000"/>
- <aura:attribute type="string" name="borderColor" default="#000"/>
- <aura:attribute type="string" name="frontText" />
- <aura:attribute type="string" name="backText" />
- <aura:attribute type="boolean" name="isVerticalFlip" default="false" description="By default its Horizontal flip" />
- <div class="{! 'slds flip-container ' + (v.isVerticalFlip == false ? 'horizontal' : 'vertical') }" style="{! 'background-color:'+ v.bgColor+'; color: '+ v.fontColor+';border : 1px solid '+ v.borderColor}">
- <div class="flipper">
- <div class="front">
- {!v.frontText}
- </div>
- <div class="back">
- {!v.backText}
- </div>
- </div>
- </div>
- </aura:component>
- .slds.THIS{
- padding : 10px;
- margin : 10px;
- display: inline-block;
- border-radius: 15px;
- text-align: center;
- font-size : 2em;
- }
- .THIS .flip-container {
- perspective: 1000px;
- }
- /* hide back while swapping*/
- .THIS .front, .THIS .back {
- backface-visibility: hidden;
- position: absolute;
- top: 0;
- left: 0;
- }
- .THIS.flip-container, .THIS .front, .THIS .back {
- width: 100%;
- height: 100%;
- }
- .THIS .front {
- z-index: 2;
- }
- /* Flip Speed */
- .THIS .flipper {
- transition: 0.6s;
- transform-style: preserve-3d;
- position: relative;
- }
- .THIS.flip-container.horizontal:hover .flipper, .THIS.flip-container.horizontal.hover .flipper {
- transform: rotateY(180deg);
- }
- .THIS.horizontal .front {
- transform: rotateY(0deg);
- }
- /* back, initially hidden pane */
- .THIS.horizontal .back {
- transform: rotateY(180deg);
- }
- .THIS.flip-container.vertical:hover .flipper, .THIS.flip-container.vertical.hover .flipper {
- transform: rotateX(180deg);
- }
- .THIS.vertical .front {
- transform: rotateX(0deg);
- }
- /* back, initially hidden pane */
- .THIS.vertical .back {
- transform: rotateX(180deg);
- }
- <apex:page >
- <apex:includeLightning />
- <div style="width:50%;height:150px;" id="flipCardId" />
- <script>
- $Lightning.use("c:lightningOutAppContainer",
- function(){
- $Lightning.createComponent("c:flipCard",
- {
- borderColor: "green",
- bgColor:"white",
- fontColor:"red",
- frontText:"What is a cool about Lightning Component Development",
- backText:"You do not need to enable Lightning experience, it will work on Classic instance as well"
- },
- "flipCardId",
- function(cmp){
- console.log('Component created, do something cool here')
- });
- });
- </script>
- </apex:page>
-
- tulasiram ch
- September 02, 2017
- Like
- 0
- Continue reading or reply
Application Not displaying accountList please tell me where i did mistake.
AccountListComponent.cmp:
- <aura:component controller="AccountListController">
- <aura:attribute name="Accounts" type="account[]"/>
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- <aura:iteration items="{!v.Accounts}" var="acc">
- <ui:outputText value="{!acc.name}"/>
- </aura:iteration>
- </aura:component>
- ({
- doInit : function(component, event, helper) {
- var action = component.get("c.getAccounts");
- action.setCallback(this, function(response){
- var state = response.getState();
- $A.log(response);
- if(state == "SUCCESS"){
- component.set("v.Accounts", response.getReturnValue());
- }
- });
- $A.enqueueAction(action);
- }
- })
- public class AccountListController {
- @AuraEnabled
- public static List<account> getAccounts(){
- list<account> accs =[select id,name from account];
- return accs;
- }
- }
- <aura:application >
- <div style="height: 400px;overflow: scroll; padding-top: 10px;">
- <c:AccountListComponent />
- </div>
- </aura:application>
-
- tulasiram ch
- August 18, 2017
- Like
- 0
- Continue reading or reply
getting error like below please help me...I am learning lightning
harnessApp.app:


But i am getting above error when click on the button packed!.....
- <aura:application >
- <c:campingListItem item="{!v.a0d2800000DTLYOAA5}"/>
- </aura:application>
- <aura:component >
- <aura:attribute name="item" type="Camping_Item__c" required="true"/>
- <p> The Item is <ui:outputText value="{!v.item}"></ui:outputText></p>
- <p>Name:<ui:outputText value="{!v.item.Name}" /> </p>
- <p>Price: <ui:outputCurrency value="{!v.item.Price__c}" /> </p>
- <p>Quantity:<ui:outputNumber value="{!v.item.Quantity__c}" /> </p>
- <p>Packed:<ui:outputCheckbox value="{!v.item.Packed__c}" /> </p>
- <div><ui:button label="Packed!" press="{!c.packItem}"/>
- </div>
- </aura:component>
- ({
- packItem: function(component, event, helper) {
- var btn= event.getSource();
- var BtnMessage =btn.get("v.label");
- component.set("v.item",BtnMessage);
- var btnClicked = event.getSource();
- btnClicked.set("v.disabled",true);
- }
- })
But i am getting above error when click on the button packed!.....
-
- tulasiram ch
- August 14, 2017
- Like
- 0
- Continue reading or reply
get response back to the Server in Webservices integration using REST API
i used below code for--- when i was created a record1 in Org1, it will automatically created in Org2.
org1:
1. i used trigger to pass new record id's to the webservice calss below.
2.webservice class:
Org2:
@RestResource(urlmapping='/createAccounts/*')
global with sharing class AccountsManager {
@HttpPost global static void createAccounts(List<Account> Accounts) {
List<Id> accIds = new List<Id>();
List<Account> accList = new List<Account>(); .
for(Account a1 : Accounts) {
Account a = new Account();
a.Name = a1.Name;
a.Website = a1.Website;
a.Org1__c = a1.Id;
accList.add(a); }
insert accList;
Map<String,String> Org1Org2Map = new Map<String,String>();
for(Account a : accList) {
Org1Org2Map.put(a.Org1__c,a.id);
}
system.debug('ORGS MAP'+Org1Org2Map);
RestContext.response.responsebody = Blob.valueOf(JSON.serialize(Org1Org2Map));
}
}
i want to get back the response to org1 when the record inserted in Org2, based on that response i want to update a field on the object in the org1.
how can i achieve that. and how can i write test class for this. i refered some docs for writing test classes for web services but i didn't understand those. please help i am new to integration. Thank you!
org1:
1. i used trigger to pass new record id's to the webservice calss below.
2.webservice class:
- public class deserializeResponse{
- public string id;
- public string access_token;
- }
- public string ReturnAccessToken(sendAccountsToWebservice account){
- system.debug('entered accestoken methd');
- String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret+'&username='+username+'&password='+password;
- Http h = new Http();
- HttpRequest req = new HttpRequest();
- req.setBody(reqbody);
- req.setMethod('POST');
- req.setEndpoint('https://ap5.salesforce.com/services/oauth2/token');
- HttpResponse res = h.send(req);
- deserializeResponse resp1 = (deserializeResponse)JSON.deserialize(res.getbody(),deserializeResponse.class);
- return resp1.access_token;
- }
- @future(callout=true)
- public static void makePostCallout(set<id> accIds){
- String str;
- List<Account> accList = [select Name,Website from Account where Id IN :accIds];
- sendAccountsToWebservice acount1 = new sendAccountsToWebservice();
- String accesstoken;
- accesstoken = acount1.ReturnAccessToken(acount1);
- JSONGenerator gen = JSON.createGenerator(true);
- gen.writeStartObject();
- gen.writeFieldName('Accounts');
- gen.writeStartArray();
- for(Account a : accList)
- {
- gen.writeStartObject();
- gen.writeStringField('Name', a.Name);
- gen.writeStringField('Website', a.Website);
- gen.writeStringField('Id', a.id);
- gen.writeEndObject();
- }
- gen.writeEndArray();
- gen.writeEndObject();
- str = gen.getAsString();
- //json ends
- if(accesstoken!=null)
- {
- system.debug('AT not null');
- Http http = new Http();
- HttpRequest request = new HttpRequest();
- request.setEndpoint('https://ap5.salesforce.com/services/apexrest/createAccounts/');
- request.setMethod('POST');
- request.setHeader('Authorization','Bearer '+accesstoken);
- request.setHeader('Content-Type','application/json');
- request.setHeader('accept','application/json');
- request.setBody(str);
- system.debug('JS'+str);
- system.debug('REQ BODY'+request.getBody());
- HttpResponse response = http.send(request);
- system.debug('RESPONSE BODY'+response.getBody());
- Map<String,String> Org1Org2Map = new Map<String,String>();
- // myVar.bool = false;
- update accList;
- }
- }
Org2:
@RestResource(urlmapping='/createAccounts/*')
global with sharing class AccountsManager {
@HttpPost global static void createAccounts(List<Account> Accounts) {
List<Id> accIds = new List<Id>();
List<Account> accList = new List<Account>(); .
for(Account a1 : Accounts) {
Account a = new Account();
a.Name = a1.Name;
a.Website = a1.Website;
a.Org1__c = a1.Id;
accList.add(a); }
insert accList;
Map<String,String> Org1Org2Map = new Map<String,String>();
for(Account a : accList) {
Org1Org2Map.put(a.Org1__c,a.id);
}
system.debug('ORGS MAP'+Org1Org2Map);
RestContext.response.responsebody = Blob.valueOf(JSON.serialize(Org1Org2Map));
}
}
i want to get back the response to org1 when the record inserted in Org2, based on that response i want to update a field on the object in the org1.
how can i achieve that. and how can i write test class for this. i refered some docs for writing test classes for web services but i didn't understand those. please help i am new to integration. Thank you!
-
- tulasiram ch
- August 03, 2017
- Like
- 0
- Continue reading or reply
how to write test classes for visualforcepages please help me
Below is the code how can we write test class for this page with controller. Please help me
<apex:page controller="listViewsForContactRecords">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accountsToDisplay}" var="acc" columns="2" id="pgtparent">
<apex:column headerValue="AccountName" >
<apex:commandLink value="{!acc.name}" action="{!MethodToCall}" rerender="pgbContacts" status="status">
<apex:param value="{!acc.Id}" name="idForConts" assignTo="{!recid}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!acc.Phone}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock title="Account Related Contacts">
<apex:outputPanel id="pgbContacts">
<apex:actionStatus startText="Please Wait Loading..." stopText="" id="status"></apex:actionStatus>
<apex:pageblockTable value="{!conList }" var="cons">
<apex:column headerValue="FirstName">
<apex:inputText value="{!cons.FirstName}"/>
</apex:column>
<apex:column headerValue="LastName">
<apex:inputText value="{!cons.LastName}"/>
</apex:column>
<apex:column >
<apex:commandButton value="EditContact"/>
</apex:column>
</apex:pageblockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class listViewsForContactRecords {
public list<contact> conList{get;set;}
public string recid{get;set;}
set<id> accIds = new set<id>();
public list<account> accountsToDisplay{get;set;}
public account getAcounts() {
return null;
}
public listViewsForContactRecords(){
accountsToDisplay = [select id, name, phone from account limit 10];
}
public void MethodToCall() {
conList = [select id, FirstName, LastName from contact where accountid=:recid];
}
}
<apex:page controller="listViewsForContactRecords">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accountsToDisplay}" var="acc" columns="2" id="pgtparent">
<apex:column headerValue="AccountName" >
<apex:commandLink value="{!acc.name}" action="{!MethodToCall}" rerender="pgbContacts" status="status">
<apex:param value="{!acc.Id}" name="idForConts" assignTo="{!recid}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!acc.Phone}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock title="Account Related Contacts">
<apex:outputPanel id="pgbContacts">
<apex:actionStatus startText="Please Wait Loading..." stopText="" id="status"></apex:actionStatus>
<apex:pageblockTable value="{!conList }" var="cons">
<apex:column headerValue="FirstName">
<apex:inputText value="{!cons.FirstName}"/>
</apex:column>
<apex:column headerValue="LastName">
<apex:inputText value="{!cons.LastName}"/>
</apex:column>
<apex:column >
<apex:commandButton value="EditContact"/>
</apex:column>
</apex:pageblockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class listViewsForContactRecords {
public list<contact> conList{get;set;}
public string recid{get;set;}
set<id> accIds = new set<id>();
public list<account> accountsToDisplay{get;set;}
public account getAcounts() {
return null;
}
public listViewsForContactRecords(){
accountsToDisplay = [select id, name, phone from account limit 10];
}
public void MethodToCall() {
conList = [select id, FirstName, LastName from contact where accountid=:recid];
}
}
-
- tulasiram ch
- July 30, 2017
- Like
- 0
- Continue reading or reply
how to send birth day wishes email at particular time
if birt date of contact is 30th august , how can we send wishes alert to the contact at 29th august 11:55pm.
How can we achieve this please help me.
How can we achieve this please help me.
-
- tulasiram ch
- July 27, 2017
- Like
- 0
- Continue reading or reply
I am getting error when trying to close popup window when clicks on save/cancel please help me
Hi i used below code but its not working fine
1. Only one account record is displaying in first page
2.Popup window is not closing after record update or cancel.
Below is my code:
Page1:
<apex:page standardController="Account" recordSetVar="accs">
<script>
function OpenVfpage(pid){
var newwindow = window.open('/apex/Accsmallpopup?id='+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>
Page2:
<apex:page controller="Accpopup2" showHeader="false" sidebar="false" id="the">
<apex:form id="page">
<apex:pageblock id="close">
<apex:pageBlockSection >
<apex:inputfield value="{!a.Name}"/>
<apex:inputfield value="{!a.Phone}"/>
</apex:pageBlockSection>
<apex:pageblockbuttons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageblockbuttons>
<apex:inputHidden id="pass" value="{!status}"/>
</apex:pageblock>
<script language="JavaScript" type="text/javascript">
if(document.getElementById('the:page:close:pass').getAttribute('value') == 'true')
{
window.top.close();
}
</script>
</apex:form>
</apex:page>
Controller:
public class Accpopup2
{
public Account a {get;set;}
public string status {get;set;}
public Accpopup2()
{
a = new account();
}
public pagereference save()
{
ID caseID = apexpages.currentPage().getParameters().get('id');
if(caseid!=null)
{
account acc = [select Name,Phone from account where ID =: caseID];
acc.Name = a.Name;
acc.Phone = a.Phone;
update acc;
}
return null;
}
public pagereference cancel()
{
status = 'true';
return null;
}
}
1. Only one account record is displaying in first page
2.Popup window is not closing after record update or cancel.
Below is my code:
Page1:
<apex:page standardController="Account" recordSetVar="accs">
<script>
function OpenVfpage(pid){
var newwindow = window.open('/apex/Accsmallpopup?id='+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>
Page2:
<apex:page controller="Accpopup2" showHeader="false" sidebar="false" id="the">
<apex:form id="page">
<apex:pageblock id="close">
<apex:pageBlockSection >
<apex:inputfield value="{!a.Name}"/>
<apex:inputfield value="{!a.Phone}"/>
</apex:pageBlockSection>
<apex:pageblockbuttons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageblockbuttons>
<apex:inputHidden id="pass" value="{!status}"/>
</apex:pageblock>
<script language="JavaScript" type="text/javascript">
if(document.getElementById('the:page:close:pass').getAttribute('value') == 'true')
{
window.top.close();
}
</script>
</apex:form>
</apex:page>
Controller:
public class Accpopup2
{
public Account a {get;set;}
public string status {get;set;}
public Accpopup2()
{
a = new account();
}
public pagereference save()
{
ID caseID = apexpages.currentPage().getParameters().get('id');
if(caseid!=null)
{
account acc = [select Name,Phone from account where ID =: caseID];
acc.Name = a.Name;
acc.Phone = a.Phone;
update acc;
}
return null;
}
public pagereference cancel()
{
status = 'true';
return null;
}
}
-
- tulasiram ch
- July 26, 2017
- Like
- 0
- Continue reading or reply
how to visible the records of Opportunities if Stage == open, and if Stage == closed only visible to sys admin and Manager
How can we achieve this:
1) visible the records of Opportunities for some users
if Stage == open,
and
2) if Stage == closed only visible to sys admin and Manager .
I think it will be possible using Criteria based Object sharing rules through sharing settings. Is there any other approaches to fullfil this. Please help me out. Thank you!
1) visible the records of Opportunities for some users
if Stage == open,
and
2) if Stage == closed only visible to sys admin and Manager .
I think it will be possible using Criteria based Object sharing rules through sharing settings. Is there any other approaches to fullfil this. Please help me out. Thank you!
-
- tulasiram ch
- July 24, 2017
- Like
- 0
- Continue reading or reply
I used following batch apex for inserting 20000 records but i am gettong null exception pls suggest me
global class batchForinsertingAccounts implements Database.Batchable<sObject>, Database.Stateful{
global integer count;
global string query;
global Database.QueryLocator start(Database.BatchableContext BC){
count=0;
return null;
}
global void execute(Database.BatchableContext BC, List<account> scope){
count=0;
list<Account> Llist = new list<Account>();
for(account acc:scope){
for(integer i=0;i<=20000 ;i++){
Account a = new account();
a.name = 'TulasiRam'+i;
Llist.add(acc);
count++;
}
}
database.insert(Llist);
}
global void finish(Database.BatchableContext BC){
system.debug(''+count);
}
}
-
- tulasiram ch
- July 13, 2017
- Like
- 0
- Continue reading or reply
how to change Email address of an user in Workflow rules emails
Suppose user have default user resgistered with email id like : user@gmail.com.
when an email alert initiated then user will get an email about update or any workflow action.
But user wants to get email alert only to his personal email which is not registered in org, and email id like yyyyyyyyyyy@yahoo.in.
when an email alert initiated then user will get an email about update or any workflow action.
But user wants to get email alert only to his personal email which is not registered in org, and email id like yyyyyyyyyyy@yahoo.in.
-
- tulasiram ch
- July 06, 2017
- Like
- 0
- Continue reading or reply
help me out in this trigger code error:
I am using custom settings in the below example : i don't know how to achieve this. i wrote below trigger but its not working please help me.
I stored some values in custom settings. Post an error if any user try to insert a value already existed in custom settings.
I stored some values in custom settings. Post an error if any user try to insert a value already existed in custom settings.
- trigger comparingExistedNumbers on Order_Product_Item__c (before insert)
- {
- set<id> setIds = new set<id>();
- for(Order_Product_Item__c orders : trigger.new)
- {
- if(orders.Enter_Number_Value__c != null)
- {
- setIds.add(orders.Enter_Number_Value__c);
- }
- list<Order_Product_Item__c> listofOrders = [select id, Enter_Number_Value__c from Order_Product_Item__c where id in:setIds];
- list<string> values = new list<string>();
- list<preDefinedValueList__c> cusList = preDefinedValueList__c.getAll().values(); // getting list of values in Custom settings
- for(Order_Product_Item__c newOrders:listofOrders)
- {
- for(preDefinedValueList__c custom : cusList)
- {
- //system.debug('' +custom.code__c);
- // system.debug('' +custom.Number__c);
- values.add(custom.Number__c); // data set strings storing in values variable
- }
- for(integer i=0; i<values.size();i++)
- { //comparing values
- if(newOrders.Enter_Number_Value__c ==values[i]){
- newOrders.Enter_Number_Value__c.addError('Do not enter existing values');
- }
- }
- }
- }
- }
-
- tulasiram ch
- July 03, 2017
- Like
- 0
- Continue reading or reply
how to use custom Settings in Triggers
I was stored a list of numbers in customSettings__c
i have a "Enter_Number__c " field on Object__c.
Then if a user enter any value already existed in the customSettings__c, it will throw an error.
How can we do that.
1.Using Trigger
2.Using Validations. please help me out.
i have a "Enter_Number__c " field on Object__c.
Then if a user enter any value already existed in the customSettings__c, it will throw an error.
How can we do that.
1.Using Trigger
2.Using Validations. please help me out.
-
- tulasiram ch
- July 02, 2017
- Like
- 0
- Continue reading or reply
Can anyone hel me in the below page code
Hi i developed below page for displaying childs of account in the page. But when i click on child record tab it refreshing all the page. But i don't want that to full page refresh . Help out please
Page: <apex:page controller="ApexController" tabStyle="account">
<apex:pageBlock mode="Edit" >
<apex:pageBlockSection title="Master Record Details" columns="1" >
<apex:outputField value="{!MasterRecord.Name}" />
<apex:outputField value="{!MasterRecord.Country__c}" />
<apex:outputField value="{!MasterRecord.Phone}" />
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockSection title="Displaying Child Records" columns="1">
<apex:tabPanel id="tbpanel1">
<apex:tab label="Contact">
<apex:outputPanel id="conPanel">
<apex:pageBlockTable value="{!ChildRecords}" var="con">
<apex:column value="{!con.FirstName}" />
<apex:column value="{!con.LastName}" />
<apex:column value="{!con.Phone}" />
</apex:pageBlockTable>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Opportunity" id="oppTab">
<apex:outputPanel id="oppPanel">
<apex:pageBlockTable value="{!oppChildRecords}" var="opp" id="opps" >
<apex:column value="{!opp.Name}" />
<apex:column value="{!opp.Amount}" />
<apex:column value="{!opp.OrderNumber__c}" />
</apex:pageBlockTable>
</apex:outputPanel>
</apex:tab>
</apex:tabPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Controller:
public with sharing class ApexController {
public String MasterRecordId {get; set;}
public List<contact> ChildRecords {get; set;}
public account MasterRecord {get; set;}
public List<opportunity> oppChildRecords {get; set;}
public ApexController()
{
MasterRecordId = ApexPages.currentPage().getParameters().get('id');
if(!String.isBlank(MasterRecordId)){
MasterRecord =[SELECT Name,Country__c,Phone FROM account WHERE Id = :MasterRecordId ];
ChildRecords =[SELECT FirstName,LastName,Phone FROM contact WHERE accountId = :MasterRecordId];
oppChildRecords =[SELECT Name,Amount,OrderNumber__c FROM opportunity WHERE accountId = :MasterRecordId];
}
}
}
Page: <apex:page controller="ApexController" tabStyle="account">
<apex:pageBlock mode="Edit" >
<apex:pageBlockSection title="Master Record Details" columns="1" >
<apex:outputField value="{!MasterRecord.Name}" />
<apex:outputField value="{!MasterRecord.Country__c}" />
<apex:outputField value="{!MasterRecord.Phone}" />
</apex:pageBlockSection>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockSection title="Displaying Child Records" columns="1">
<apex:tabPanel id="tbpanel1">
<apex:tab label="Contact">
<apex:outputPanel id="conPanel">
<apex:pageBlockTable value="{!ChildRecords}" var="con">
<apex:column value="{!con.FirstName}" />
<apex:column value="{!con.LastName}" />
<apex:column value="{!con.Phone}" />
</apex:pageBlockTable>
</apex:outputPanel>
</apex:tab>
<apex:tab label="Opportunity" id="oppTab">
<apex:outputPanel id="oppPanel">
<apex:pageBlockTable value="{!oppChildRecords}" var="opp" id="opps" >
<apex:column value="{!opp.Name}" />
<apex:column value="{!opp.Amount}" />
<apex:column value="{!opp.OrderNumber__c}" />
</apex:pageBlockTable>
</apex:outputPanel>
</apex:tab>
</apex:tabPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Controller:
public with sharing class ApexController {
public String MasterRecordId {get; set;}
public List<contact> ChildRecords {get; set;}
public account MasterRecord {get; set;}
public List<opportunity> oppChildRecords {get; set;}
public ApexController()
{
MasterRecordId = ApexPages.currentPage().getParameters().get('id');
if(!String.isBlank(MasterRecordId)){
MasterRecord =[SELECT Name,Country__c,Phone FROM account WHERE Id = :MasterRecordId ];
ChildRecords =[SELECT FirstName,LastName,Phone FROM contact WHERE accountId = :MasterRecordId];
oppChildRecords =[SELECT Name,Amount,OrderNumber__c FROM opportunity WHERE accountId = :MasterRecordId];
}
}
}
-
- tulasiram ch
- July 02, 2017
- Like
- 0
- Continue reading or reply
How can we upload records using Dataloader fom other Client org if the UserId fomat is different .
Suppose I want to update or insert records of 10 users From SAP to Salesforce using dataLoader. SAP user id and Salesforce user id are different
example: SAP User1 id== 11111 and salesforce User1 id == 22222 .How can we map those records.
example: SAP User1 id== 11111 and salesforce User1 id == 22222 .How can we map those records.
-
- tulasiram ch
- June 28, 2017
- Like
- 0
- Continue reading or reply
What are account team and opportunity teams
Account====AccountTeam
Opportunity === OpportunityTeam
When I deleted Account team member from AccountTeam then automatically a member from OpportunityTeam also be deleted. How can we achieve this.
Opportunity === OpportunityTeam
When I deleted Account team member from AccountTeam then automatically a member from OpportunityTeam also be deleted. How can we achieve this.
-
- tulasiram ch
- June 28, 2017
- Like
- 0
- Continue reading or reply
How to perform updation like below scenario
- Account ==== Contact on contact Status__C field is there (Total 10 records)
How can we achieve this through?
1.trigger
2. Process Builder
- Account ==== Contact on contact Status__C field is there (Total 10 records)
-
- tulasiram ch
- June 28, 2017
- Like
- 0
- Continue reading or reply
What type of Data can we send using outbound messages, limt
1.When we need OutBound Messages and What we will include in outBound Messages
2. what type of data we can send.
3.And what are the limts on outBound messages
4.Is there any other option to send outbound messages except Workflow
2. what type of data we can send.
3.And what are the limts on outBound messages
4.Is there any other option to send outbound messages except Workflow
-
- tulasiram ch
- June 28, 2017
- Like
- 0
- Continue reading or reply
how to pass accountid to popup window for displaying related contactList in lightning
I used following component and controller with apex class: But i am knew to lightning, Please help me how to display related contactlist with accountid in new window...
DisplayAccountsWithContacts.cmp:
public class accountsWithContactsClass {
@auraEnabled
public static list<account> getAllAccounts()
{
list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
return accs;
}
}
===================================================================================================

DisplayAccountsWithContacts.cmp:
- <aura:component controller="accountsWithContactsClass" implements="flexipage:availableForAllPageTypes" access="global">
- <aura:handler name="init" value="{!this}" action="{!c.myAction}"/>
- <aura:attribute name="accounts" type="account[]"/>
- <table>
- <tr>
- <td> Name </td>
- <td> Industry </td>
- <td> Phone</td>
- <td> CreatedDate</td>
- <td> ContactList Button</td>
- </tr> <b/>
- <aura:iteration items="{!v.accounts}" var="accs1" >
- <tr>
- <td> {!accs1.Name} </td>
- <td> {!accs1.Industry} </td>
- <td> {!accs1.Phone} </td>
- <td> {!accs1.CreatedDate}</td>
- <td> <lightning:button variant="neutral" label="ContactList" onclick="{! c.handleClick }" />
- </td>
- </tr><b/>
- </aura:iteration>
- </table>
- <aura:attribute name="isOpen" type="boolean" default="false"/>
- <div class="slds-m-around--xx-large">
- <aura:if isTrue="{!v.isOpen}">
- <div role="dialog" tabindex="-1" aria-labelledby="header99" class="slds-modal slds-fade-in-open ">
- <div class="slds-modal__container">
- <!-- ###### MODAL BOX HEADER Part Start From Here ######-->
- <div class="slds-modal__header">
- <button class="slds-button slds-modal__close slds-button--icon-inverse" title="Close" onclick="{!c.closeModel}">
- <span class="slds-assistive-text">Close</span>
- </button>
- <h2 id="header99" class="slds-text-heading--medium">ContactList</h2>
- <!--###### MODAL BOX FOOTER Part Start From Here ######-->
- <div class="slds-modal__footer">
- <button class="slds-button slds-button--neutral" onclick="{!c.closeModel}" >Cancel</button>
- <button class="slds-button slds-button--brand" onclick="{!c.likenClose}">Like and Close</button>
- </div>
- </div>
- </div>
- </div>
- </aura:if>
- </div>
- </aura:component>
- ({
- myAction : function(component, event, helper) {
- var action =component.get("c.getAllAccounts");
- console.log('The action value is: '+action);
- action.setCallback(this, function(a){
- component.set("v.accounts", a.getReturnValue());
- // console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- console.log('The accs are :'+JSON.stringify(a.getReturnValue()));
- });
- $A.enqueueAction(action);
- },
- handleClick : function(component, event, helper) {
- component.set("v.isOpen", true); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- } ,
- closeModel: function(component, event, helper) {
- component.set("v.isOpen", false); // for Hide/Close Model,set the "isOpen" attribute to "Fasle"
- },
- likenClose: function(component, event, helper) {
- alert('thanks for like Us :)');// Display alert message on the click on the "Like and Close" button from Model Footer
- // and set set the "isOpen" attribute to "False for close the model Box.
- component.set("v.isOpen", false);
- },
- })
public class accountsWithContactsClass {
@auraEnabled
public static list<account> getAllAccounts()
{
list<account> accs =[select id,name,phone,industry,CreatedDate from account limit 10];
return accs;
}
}
===================================================================================================
- tulasiram ch
- September 11, 2017
- Like
- 0
- Continue reading or reply
I have used lightning component in visualforce page. I got this code from one of the website. But flipcard background color is not working please help me...
App:
- <aura:application access="global" extends="ltng:outApp">
- <aura:dependency resource="c:flipCard" />
- </aura:application>
- <aura:component >
- <aura:attribute type="string" name="bgColor" />
- <aura:attribute type="string" name="fontColor" default="#000"/>
- <aura:attribute type="string" name="borderColor" default="#000"/>
- <aura:attribute type="string" name="frontText" />
- <aura:attribute type="string" name="backText" />
- <aura:attribute type="boolean" name="isVerticalFlip" default="false" description="By default its Horizontal flip" />
- <div class="{! 'slds flip-container ' + (v.isVerticalFlip == false ? 'horizontal' : 'vertical') }" style="{! 'background-color:'+ v.bgColor+'; color: '+ v.fontColor+';border : 1px solid '+ v.borderColor}">
- <div class="flipper">
- <div class="front">
- {!v.frontText}
- </div>
- <div class="back">
- {!v.backText}
- </div>
- </div>
- </div>
- </aura:component>
- .slds.THIS{
- padding : 10px;
- margin : 10px;
- display: inline-block;
- border-radius: 15px;
- text-align: center;
- font-size : 2em;
- }
- .THIS .flip-container {
- perspective: 1000px;
- }
- /* hide back while swapping*/
- .THIS .front, .THIS .back {
- backface-visibility: hidden;
- position: absolute;
- top: 0;
- left: 0;
- }
- .THIS.flip-container, .THIS .front, .THIS .back {
- width: 100%;
- height: 100%;
- }
- .THIS .front {
- z-index: 2;
- }
- /* Flip Speed */
- .THIS .flipper {
- transition: 0.6s;
- transform-style: preserve-3d;
- position: relative;
- }
- .THIS.flip-container.horizontal:hover .flipper, .THIS.flip-container.horizontal.hover .flipper {
- transform: rotateY(180deg);
- }
- .THIS.horizontal .front {
- transform: rotateY(0deg);
- }
- /* back, initially hidden pane */
- .THIS.horizontal .back {
- transform: rotateY(180deg);
- }
- .THIS.flip-container.vertical:hover .flipper, .THIS.flip-container.vertical.hover .flipper {
- transform: rotateX(180deg);
- }
- .THIS.vertical .front {
- transform: rotateX(0deg);
- }
- /* back, initially hidden pane */
- .THIS.vertical .back {
- transform: rotateX(180deg);
- }
- <apex:page >
- <apex:includeLightning />
- <div style="width:50%;height:150px;" id="flipCardId" />
- <script>
- $Lightning.use("c:lightningOutAppContainer",
- function(){
- $Lightning.createComponent("c:flipCard",
- {
- borderColor: "green",
- bgColor:"white",
- fontColor:"red",
- frontText:"What is a cool about Lightning Component Development",
- backText:"You do not need to enable Lightning experience, it will work on Classic instance as well"
- },
- "flipCardId",
- function(cmp){
- console.log('Component created, do something cool here')
- });
- });
- </script>
- </apex:page>
- tulasiram ch
- September 02, 2017
- Like
- 0
- Continue reading or reply
Application Not displaying accountList please tell me where i did mistake.
AccountListComponent.cmp:
- <aura:component controller="AccountListController">
- <aura:attribute name="Accounts" type="account[]"/>
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- <aura:iteration items="{!v.Accounts}" var="acc">
- <ui:outputText value="{!acc.name}"/>
- </aura:iteration>
- </aura:component>
- ({
- doInit : function(component, event, helper) {
- var action = component.get("c.getAccounts");
- action.setCallback(this, function(response){
- var state = response.getState();
- $A.log(response);
- if(state == "SUCCESS"){
- component.set("v.Accounts", response.getReturnValue());
- }
- });
- $A.enqueueAction(action);
- }
- })
- public class AccountListController {
- @AuraEnabled
- public static List<account> getAccounts(){
- list<account> accs =[select id,name from account];
- return accs;
- }
- }
- <aura:application >
- <div style="height: 400px;overflow: scroll; padding-top: 10px;">
- <c:AccountListComponent />
- </div>
- </aura:application>
- tulasiram ch
- August 18, 2017
- Like
- 0
- Continue reading or reply
how to write test classes for visualforcepages please help me
Below is the code how can we write test class for this page with controller. Please help me
<apex:page controller="listViewsForContactRecords">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accountsToDisplay}" var="acc" columns="2" id="pgtparent">
<apex:column headerValue="AccountName" >
<apex:commandLink value="{!acc.name}" action="{!MethodToCall}" rerender="pgbContacts" status="status">
<apex:param value="{!acc.Id}" name="idForConts" assignTo="{!recid}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!acc.Phone}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock title="Account Related Contacts">
<apex:outputPanel id="pgbContacts">
<apex:actionStatus startText="Please Wait Loading..." stopText="" id="status"></apex:actionStatus>
<apex:pageblockTable value="{!conList }" var="cons">
<apex:column headerValue="FirstName">
<apex:inputText value="{!cons.FirstName}"/>
</apex:column>
<apex:column headerValue="LastName">
<apex:inputText value="{!cons.LastName}"/>
</apex:column>
<apex:column >
<apex:commandButton value="EditContact"/>
</apex:column>
</apex:pageblockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class listViewsForContactRecords {
public list<contact> conList{get;set;}
public string recid{get;set;}
set<id> accIds = new set<id>();
public list<account> accountsToDisplay{get;set;}
public account getAcounts() {
return null;
}
public listViewsForContactRecords(){
accountsToDisplay = [select id, name, phone from account limit 10];
}
public void MethodToCall() {
conList = [select id, FirstName, LastName from contact where accountid=:recid];
}
}
<apex:page controller="listViewsForContactRecords">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accountsToDisplay}" var="acc" columns="2" id="pgtparent">
<apex:column headerValue="AccountName" >
<apex:commandLink value="{!acc.name}" action="{!MethodToCall}" rerender="pgbContacts" status="status">
<apex:param value="{!acc.Id}" name="idForConts" assignTo="{!recid}"/>
</apex:commandLink>
</apex:column>
<apex:column value="{!acc.Phone}"/>
</apex:pageblockTable>
</apex:pageBlock>
<apex:pageBlock title="Account Related Contacts">
<apex:outputPanel id="pgbContacts">
<apex:actionStatus startText="Please Wait Loading..." stopText="" id="status"></apex:actionStatus>
<apex:pageblockTable value="{!conList }" var="cons">
<apex:column headerValue="FirstName">
<apex:inputText value="{!cons.FirstName}"/>
</apex:column>
<apex:column headerValue="LastName">
<apex:inputText value="{!cons.LastName}"/>
</apex:column>
<apex:column >
<apex:commandButton value="EditContact"/>
</apex:column>
</apex:pageblockTable>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public class listViewsForContactRecords {
public list<contact> conList{get;set;}
public string recid{get;set;}
set<id> accIds = new set<id>();
public list<account> accountsToDisplay{get;set;}
public account getAcounts() {
return null;
}
public listViewsForContactRecords(){
accountsToDisplay = [select id, name, phone from account limit 10];
}
public void MethodToCall() {
conList = [select id, FirstName, LastName from contact where accountid=:recid];
}
}
- tulasiram ch
- July 30, 2017
- Like
- 0
- Continue reading or reply
how to send birth day wishes email at particular time
if birt date of contact is 30th august , how can we send wishes alert to the contact at 29th august 11:55pm.
How can we achieve this please help me.
How can we achieve this please help me.
- tulasiram ch
- July 27, 2017
- Like
- 0
- Continue reading or reply
I am getting error when trying to close popup window when clicks on save/cancel please help me
Hi i used below code but its not working fine
1. Only one account record is displaying in first page
2.Popup window is not closing after record update or cancel.
Below is my code:
Page1:
<apex:page standardController="Account" recordSetVar="accs">
<script>
function OpenVfpage(pid){
var newwindow = window.open('/apex/Accsmallpopup?id='+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>
Page2:
<apex:page controller="Accpopup2" showHeader="false" sidebar="false" id="the">
<apex:form id="page">
<apex:pageblock id="close">
<apex:pageBlockSection >
<apex:inputfield value="{!a.Name}"/>
<apex:inputfield value="{!a.Phone}"/>
</apex:pageBlockSection>
<apex:pageblockbuttons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageblockbuttons>
<apex:inputHidden id="pass" value="{!status}"/>
</apex:pageblock>
<script language="JavaScript" type="text/javascript">
if(document.getElementById('the:page:close:pass').getAttribute('value') == 'true')
{
window.top.close();
}
</script>
</apex:form>
</apex:page>
Controller:
public class Accpopup2
{
public Account a {get;set;}
public string status {get;set;}
public Accpopup2()
{
a = new account();
}
public pagereference save()
{
ID caseID = apexpages.currentPage().getParameters().get('id');
if(caseid!=null)
{
account acc = [select Name,Phone from account where ID =: caseID];
acc.Name = a.Name;
acc.Phone = a.Phone;
update acc;
}
return null;
}
public pagereference cancel()
{
status = 'true';
return null;
}
}
1. Only one account record is displaying in first page
2.Popup window is not closing after record update or cancel.
Below is my code:
Page1:
<apex:page standardController="Account" recordSetVar="accs">
<script>
function OpenVfpage(pid){
var newwindow = window.open('/apex/Accsmallpopup?id='+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>
Page2:
<apex:page controller="Accpopup2" showHeader="false" sidebar="false" id="the">
<apex:form id="page">
<apex:pageblock id="close">
<apex:pageBlockSection >
<apex:inputfield value="{!a.Name}"/>
<apex:inputfield value="{!a.Phone}"/>
</apex:pageBlockSection>
<apex:pageblockbuttons >
<apex:commandButton value="save" action="{!save}"/>
<apex:commandButton value="cancel" action="{!cancel}"/>
</apex:pageblockbuttons>
<apex:inputHidden id="pass" value="{!status}"/>
</apex:pageblock>
<script language="JavaScript" type="text/javascript">
if(document.getElementById('the:page:close:pass').getAttribute('value') == 'true')
{
window.top.close();
}
</script>
</apex:form>
</apex:page>
Controller:
public class Accpopup2
{
public Account a {get;set;}
public string status {get;set;}
public Accpopup2()
{
a = new account();
}
public pagereference save()
{
ID caseID = apexpages.currentPage().getParameters().get('id');
if(caseid!=null)
{
account acc = [select Name,Phone from account where ID =: caseID];
acc.Name = a.Name;
acc.Phone = a.Phone;
update acc;
}
return null;
}
public pagereference cancel()
{
status = 'true';
return null;
}
}
- tulasiram ch
- July 26, 2017
- Like
- 0
- Continue reading or reply
I used following batch apex for inserting 20000 records but i am gettong null exception pls suggest me
global class batchForinsertingAccounts implements Database.Batchable<sObject>, Database.Stateful{
global integer count;
global string query;
global Database.QueryLocator start(Database.BatchableContext BC){
count=0;
return null;
}
global void execute(Database.BatchableContext BC, List<account> scope){
count=0;
list<Account> Llist = new list<Account>();
for(account acc:scope){
for(integer i=0;i<=20000 ;i++){
Account a = new account();
a.name = 'TulasiRam'+i;
Llist.add(acc);
count++;
}
}
database.insert(Llist);
}
global void finish(Database.BatchableContext BC){
system.debug(''+count);
}
}
- tulasiram ch
- July 13, 2017
- Like
- 0
- Continue reading or reply
help me out in this trigger code error:
I am using custom settings in the below example : i don't know how to achieve this. i wrote below trigger but its not working please help me.
I stored some values in custom settings. Post an error if any user try to insert a value already existed in custom settings.
I stored some values in custom settings. Post an error if any user try to insert a value already existed in custom settings.
- trigger comparingExistedNumbers on Order_Product_Item__c (before insert)
- {
- set<id> setIds = new set<id>();
- for(Order_Product_Item__c orders : trigger.new)
- {
- if(orders.Enter_Number_Value__c != null)
- {
- setIds.add(orders.Enter_Number_Value__c);
- }
- list<Order_Product_Item__c> listofOrders = [select id, Enter_Number_Value__c from Order_Product_Item__c where id in:setIds];
- list<string> values = new list<string>();
- list<preDefinedValueList__c> cusList = preDefinedValueList__c.getAll().values(); // getting list of values in Custom settings
- for(Order_Product_Item__c newOrders:listofOrders)
- {
- for(preDefinedValueList__c custom : cusList)
- {
- //system.debug('' +custom.code__c);
- // system.debug('' +custom.Number__c);
- values.add(custom.Number__c); // data set strings storing in values variable
- }
- for(integer i=0; i<values.size();i++)
- { //comparing values
- if(newOrders.Enter_Number_Value__c ==values[i]){
- newOrders.Enter_Number_Value__c.addError('Do not enter existing values');
- }
- }
- }
- }
- }
- tulasiram ch
- July 03, 2017
- Like
- 0
- Continue reading or reply
What is the difference between enhanced profile user interface and non-enhanced profile user interface
Which profile should be assigned for a User(Developer) in Real time. and what is the difference between Enhanced and Non-Enhanced user Interfaces Please help me .
- tulasiram ch
- June 27, 2017
- Like
- 0
- Continue reading or reply
What type of Apex sharing rules will be enforced on extension controller
Case 1: I used Standard Controller with Extension controller . Then what type of Apex sharing rules will be enforced on extensions.
case 2: I used custom controller with Extension controller . Then what type of Apex sharing rules will be enforced on extensions.
case 2: I used custom controller with Extension controller . Then what type of Apex sharing rules will be enforced on extensions.
- tulasiram ch
- June 27, 2017
- Like
- 0
- Continue reading or reply