• aks0011
  • NEWBIE
  • 0 Points
  • Member since 2013

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

I'm trying to create a portal user using Site.CreatePortalUser(user, accountId,'password', true) method of site class, making a call from my helper js but it's not working and not porviding me debug logs also.
Hi,

I'm trying to save an account record using lightning component but it's not working. I've the below mentioned code so please look at this and let me know if I'm missing or doing ways wrong.

thanks in advance :)


Demo.cmp
<aura:component controller="DemoPageController" implements="force:appHostable">
    <aura:attribute name="accounts" type="account"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <div class="slds">
        <fieldset class="slds-form--compound">
            <div class="form-element__group">
                <div class="slds-form-element__row">
                    <div class="slds-form-element slds-size--1-of-2">
                        <label class="slds-form-element__label" for="input-01">Name</label>
                        <ui:inputText class="slds-input" value="{!v.accounts.Name}"/>
                    </div>
                </div>
            </div>
        </fieldset>
        <div class="slds-form-element__row slds-p-top--small">
            <input type="button" value="Save" class="slds-button slds-button--brand"
                   onclick="{!c.submit}"/>
        </div>
    </div>
</aura:component>

DemoController.js

({
    doInit : function(component, event, helper) {
        helper.getAccounts(component);
    },
    
    submit : function(component, event, helper) {
        var newAccRec = component.get('v.accounts');
        console.log(newAccRec);
        helper.save(component, newAccRec);
    },
})

DemoHelper.js

({
    getAccounts: function(component) {
        var action = component.get("c.getAccounts");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                component.set("v.accounts", response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    },
    
    save : function(component, newAccRec) {
        var action = component.get("c.saveRecord");
        action.setParams({
            "accountRecord": newAccRec
        });
        action.setCallback(this, function(response) {
            var isSaved = response.getReturnValue();
            if (isSaved) {
                console.log('record saved '+isSaved+' and execution ends...');
            }
            else
                console.log('record saved false and execution ends...');
        });
        $A.enqueueAction(action);
    },
})

DemoPageController.apxc

public class DemoPageController {
    @AuraEnabled
    public static Account getAccounts() {
        return new account(name = 'test light account');
    }
    
    @AuraEnabled
    public static boolean saveRecord(Account accountRecord) {
        system.debug('@apex save...' + accountRecord);
        return true;
    }
}

This above mentioned code is supposed to be worked to save a new account record in sf database.

I'm using this in SF classic as given below -:

DemoPage.vfp

<apex:page sidebar="false">
    <apex:stylesheet value="{!URLFOR($Resource.SLDS0121, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
    <apex:includeLightning />
    <div id="containerLight">
        <div id="Lightning"/>
    </div>
    
    <script>
        $Lightning.use("c:DemoApp", function(){
            $Lightning.createComponent("c:Demo",{},"Lightning",function(cmp){
                
            });
        });
    </script>
</apex:page>
Hi,

I'm facing an issue while passing a sobject in parameters from a form helper js to apex controller's aura enabled method that works to save that form's data in DB. At the Client side It works well or I don't know but at Apex controller there is an error is being occurred as [VARIABLE_ASSIGNMENT [6]|ex|"common.apex.runtime.impl.ExecutionException: Attempt to de-reference a null object"|0x3a7b04fe] so if anyone has the solution then please let me know. 

thanks in advance :)
Hi, 

If anyone has any idea that how can we pass a parameter in $Lightning.use(); method and how it works then please let me know .

thanks in advance .... :)
 
Hi,

I'm using a lightning component in my vf page and somehow my use case is to create that component on page for multiple times and the app as well -> so now I want to make a new instance of a list type of aura attribute as per the component created in vf page.
<div class="slds-form-element">
                    <apex:variable var="idVal" value="{!0}"/>
                    <apex:repeat value="{!ReferenceObjects}" var="f">
                        <script>
                            $Lightning.use("c:LookupApp", function(){
                                $Lightning.createComponent("c:Lookup",{"objectName":"{!f}"},"{!idVal}",function(cmp){
                                    console.log("entered");
                                });
                            });
                        </script>
                        <div id="{!idVal}"></div>
                        <apex:variable var="idVal" value="{!idVal+1}"/>
                    </apex:repeat>
                </div>

so how can I instatiate the aura attribute so if anyone knows that how to achieve this then please let me know.

thanks in advance...... :) 
Hi,

I'm writing a delete trigger and that is bulkify too. I'm not getting the way to prevent valid data of being delete. like for example if I have 10 record to delete and 2 of them are valid or supposed not to be deleted by anyone. so my use case is those 2 recoreds should will not be deleted . and rest all (8) can be deleted easily.

so if anyone knows about it then please let me know. thanks in advance.
Hi,

I have just used a java program to insert an account externally...
but I have not Understand it completely .... so now I want to know about these classes, all in it's liabrary.

com.sforce.soap.enterprise.EnterpriseConnection
com.sforce.soap.enterprise.GetUserInfoResult
com.sforce.soap.enterprise.sobject.Account
com.sforce.ws.ConnectionException
com.sforce.ws.ConnectorConfig

so if anyone can provide a good link to know thease all than plz let me know . thanks. in advance.
hi guys....

I am trying to add a feature in my page block table like a more column for choosing a list of salesorders. and for that I need a dropdown menu with multiselect functionality with checkboxes ....... here is code sample...

<apex:page controller="MultiSelectDropdownMenu">
    
    <script>
       
        function checkAll(cb){
        var inputElem = document.getElementsByTagName("input");
            for(var i=0; i<inputElem.length; i++){
                if(inputElem[i].id.indexOf("checkedone")!=-1)
                    inputElem[i].checked = cb.checked;
            }
        }
       
        function myFunction(id){
            alert(col +'----'+ id);
            document.getElementById(id).style.display= 'block';
        }

        function calcDedSecCCD(elm) {
            var eid = elm.id;
           
            document.getElementById(x).style.display= 'block';
        }
       
        function myFunction1(){
            //alert('bye');
            var x= document.getElementById('panel').style.display= 'none';
            document.getElementById('flip').style.display= 'block';
            document.getElementById('flip1').style.display= 'none';
        }
       
    </script>
    <apex:form id="main">
    <apex:pageBlock id="pb" >
    <apex:pageBlockTable value="{!selectedSOrders1}" var="s" id="pbt">
    <apex:column value="{!s.name}" />
   
    <apex:column id="pbtc" headerValue="TAX" onclick="calcDedSecCCD(this)">
        <div id="p" style="border:1px solid black;width:125px;height:auto;padding:5px;">
            <div id="panel"  style="width:125px;height:auto;padding:5px;display:none;">
                <hr></hr>
        <apex:dataTable id="pbdt" value="{!SalesOrders}" var="a" cellpadding="5">
            <apex:column >
            <apex:facet name="header"> <apex:inputCheckbox >
            <apex:actionSupport event="onclick" action="{!GetSelected}" onsubmit="checkAll(this)" rerender="Selected_PBS"/>
            </apex:inputCheckbox></apex:facet>
            <apex:inputCheckbox value="{!a.selected}" id="checkedone">
            <apex:actionSupport event="onclick" action="{!GetSelected}" rerender="Selected_PBS"/>
            </apex:inputCheckbox>
            </apex:column>
            <apex:column headervalue="All" value="{!a.acc.Name}" />
        </apex:dataTable>
         </div>
        </div>
    </apex:column>
    </apex:pageBlockTable>
    </apex:pageBlock>
    <br/><br/><br/>
    <apex:pageBlock >
    <apex:pageBlockSection Title="Selected Orders" id="Selected_PBS">
    <apex:dataTable value="{!SelectedSOrders}" var="s" columnswidth="50px,50px" cellpadding="4" border="1">
        <apex:column headervalue="Name" value="{!s.id}" />
    </apex:dataTable>
    </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
</apex:page>

so this is not giving me the id of component from where I clicked the colum of row.

now you can see the hierarchy so if anyone have any solution than plz let me know...
public PageReference addNewObject(){
        name = objectName;
        Schema.sObjectType SObTypeObj = Schema.getGlobalDescribe().get(name);
        system.debug('@cO' +SObTypeObj +'----'+ name);
        for(sortedMappingChildren  s :finalMapChildren){
            if(s.objName == name){
                sObject so = SObTypeObj.newSobject();
                s.obj.add(so);
            }
        }
        system.assert(false, finalMapChildren);
        return null;
    }
Hi,


I want to get if Opportunity has an Field set of it's Fields, by knowing only that it's an opportunity record.


if any one know it than please let me know . thanks in advance ...... :)
HI,

I want to creat opportunityLineItemSchedule in my test class and I'm not getting the way... my code is....

Product2 objproductQS = new Product2();
objproductQS.name ='testproduct1';
objproductQS.IsActive = true;
objproductQS.CanUseQuantitySchedule = true;
objproductQS.QuantityInstallmentPeriod = 'weekly';
objproductQS.QuantityScheduleType = 'Divide';
objproductQS.NumberOfQuantityInstallments = 52;
insert objproductQS;

List<Pricebook2> pid=[Select Id From Pricebook2 where name = 'Standard Price Book'];
String stdPbId = pid[0].Id;

PricebookEntry objpricebookEntryQS = new PricebookEntry();
objpricebookEntryQS.Pricebook2Id = stdPbId;
objpricebookEntryQS.Product2Id = objproductQS.id;
objpricebookEntryQS.UnitPrice = Decimal.valueof(33333);
objpricebookEntryQS.IsActive = true;
insert objpricebookEntryQS;

opportunityLineItemSchedule ols = new opportunityLineItemSchedule();
ols.ScheduleDate = date.today();
ols.opportunityLineItemID = objoliQS.id;
ols.type = 'quantity';
insert ols;

giving me this error..... System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: Type,
Quantity, unknown (invalid quantity/revenue for given type): [Type, Quantity, unknown]

so anyone knows about it's any fix .. than plz let me know..... thanks ............. :)
HI,

Is there any other way to check the problems in code coverage except using developer console. May you are also facing the same problem with Developer console. Please let me know if anyone knows about it.

thanks....
Hi,

I'm writing a delete trigger and that is bulkify too. I'm not getting the way to prevent valid data of being delete. like for example if I have 10 record to delete and 2 of them are valid or supposed not to be deleted by anyone. so my use case is those 2 recoreds should will not be deleted . and rest all (8) can be deleted easily.

so if anyone knows about it then please let me know. thanks in advance.
HI,

Is there any other way to check the problems in code coverage except using developer console. May you are also facing the same problem with Developer console. Please let me know if anyone knows about it.

thanks....
Hi,

I'm trying to create a portal user using Site.CreatePortalUser(user, accountId,'password', true) method of site class, making a call from my helper js but it's not working and not porviding me debug logs also.
Hi,

I'm trying to save an account record using lightning component but it's not working. I've the below mentioned code so please look at this and let me know if I'm missing or doing ways wrong.

thanks in advance :)


Demo.cmp
<aura:component controller="DemoPageController" implements="force:appHostable">
    <aura:attribute name="accounts" type="account"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <div class="slds">
        <fieldset class="slds-form--compound">
            <div class="form-element__group">
                <div class="slds-form-element__row">
                    <div class="slds-form-element slds-size--1-of-2">
                        <label class="slds-form-element__label" for="input-01">Name</label>
                        <ui:inputText class="slds-input" value="{!v.accounts.Name}"/>
                    </div>
                </div>
            </div>
        </fieldset>
        <div class="slds-form-element__row slds-p-top--small">
            <input type="button" value="Save" class="slds-button slds-button--brand"
                   onclick="{!c.submit}"/>
        </div>
    </div>
</aura:component>

DemoController.js

({
    doInit : function(component, event, helper) {
        helper.getAccounts(component);
    },
    
    submit : function(component, event, helper) {
        var newAccRec = component.get('v.accounts');
        console.log(newAccRec);
        helper.save(component, newAccRec);
    },
})

DemoHelper.js

({
    getAccounts: function(component) {
        var action = component.get("c.getAccounts");
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (component.isValid() && state === "SUCCESS") {
                component.set("v.accounts", response.getReturnValue());
            }
        });
        $A.enqueueAction(action);
    },
    
    save : function(component, newAccRec) {
        var action = component.get("c.saveRecord");
        action.setParams({
            "accountRecord": newAccRec
        });
        action.setCallback(this, function(response) {
            var isSaved = response.getReturnValue();
            if (isSaved) {
                console.log('record saved '+isSaved+' and execution ends...');
            }
            else
                console.log('record saved false and execution ends...');
        });
        $A.enqueueAction(action);
    },
})

DemoPageController.apxc

public class DemoPageController {
    @AuraEnabled
    public static Account getAccounts() {
        return new account(name = 'test light account');
    }
    
    @AuraEnabled
    public static boolean saveRecord(Account accountRecord) {
        system.debug('@apex save...' + accountRecord);
        return true;
    }
}

This above mentioned code is supposed to be worked to save a new account record in sf database.

I'm using this in SF classic as given below -:

DemoPage.vfp

<apex:page sidebar="false">
    <apex:stylesheet value="{!URLFOR($Resource.SLDS0121, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
    <apex:includeLightning />
    <div id="containerLight">
        <div id="Lightning"/>
    </div>
    
    <script>
        $Lightning.use("c:DemoApp", function(){
            $Lightning.createComponent("c:Demo",{},"Lightning",function(cmp){
                
            });
        });
    </script>
</apex:page>
Hi,

I'm facing an issue while passing a sobject in parameters from a form helper js to apex controller's aura enabled method that works to save that form's data in DB. At the Client side It works well or I don't know but at Apex controller there is an error is being occurred as [VARIABLE_ASSIGNMENT [6]|ex|"common.apex.runtime.impl.ExecutionException: Attempt to de-reference a null object"|0x3a7b04fe] so if anyone has the solution then please let me know. 

thanks in advance :)
Hi,

I'm writing a delete trigger and that is bulkify too. I'm not getting the way to prevent valid data of being delete. like for example if I have 10 record to delete and 2 of them are valid or supposed not to be deleted by anyone. so my use case is those 2 recoreds should will not be deleted . and rest all (8) can be deleted easily.

so if anyone knows about it then please let me know. thanks in advance.
Hi,


I want to get if Opportunity has an Field set of it's Fields, by knowing only that it's an opportunity record.


if any one know it than please let me know . thanks in advance ...... :)