Scenario : 1 DML Call Using Constructor
-----------------------------------------------------------------------------------------------------------------------
public class InsertObjectController
{
public Boolean myFlag {get; set;}
public Account acc {get; set;}
public InsertObjectController()
{
myFlag=false;
}
public void init()
{
if (!myFlag)
{
acc=new Account();
acc.Name='Mindfire Account';
insert acc;
myFlag=true;
}
}
}
-----------------------------------------------------------------------------------------------------------------
<apex:page controller="InsertObjectController">
<apex:form >
<apex:actionFunction name="doInit" action="{!init}" rerender="allPanel"/>
<apex:outputPanel id="allPanel">
<apex:outputPanel rendered="{!NOT(myFlag)}">
<p align="center" style='{font-family:"Arial", Helvetica, sans-serif; font-size:20px;}'>
<apex:image value="/img/loading.gif"/> Please wait</p>
<script>
window.onload=function()
{
doInit();
};
</script>
</apex:outputPanel>
<apex:outputPanel rendered="{!myFlag}">
<apex:pageBlock title="Account Details">
<apex:pageBlockSection >
<apex:inputField value="{!acc.id}"/>
<apex:inputField value="{!acc.name}"/>
<apex:inputField value="{!acc.type}"/>
<apex:inputField value="{!acc.industry}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
</apex:outputPanel>
</apex:form>
</apex:page>
How can i identify the admin (standard/cloned) profile of current User using Apex Code
String ProfId= UserInfo.getProfileId();
List<Profile> lstP = [select id,name,UserLicenseId,UserType from Profile where id =: ProfId and name like '%admin%' ];
system.debug('----> Profile Data is --->'+lstP[0]);
system.debug('----> Profile Data is --->'+lstP[0]);
No comments:
Post a Comment