• 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,

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 ...... :)