Search In This Blog

2021-02-26

Call Apex Method with parameter and show result message | Aura

 CMP:

<aura:component implements="force:lightningQuickActionWithoutHeader,force:hasRecordId" controller="InvoiceIssueController" access="global">

<aura:html tag="style">

       .slds-modal__container{ 

         height : auto; width: 80%; max-width: 70vh; 

       } 

       .modal-body{ 

        height : 15vh !important;

        max-height: 15vh !important; 

       } 

       .slds-modal__footer{ 

         display: inline !important; 

       }

    </aura:html>

    

    <aura:handler name="init" value="{!this}" action="{!c.callServer}"/>

    <aura:handler event="force:refreshView" action="{!c.isRefreshed}" />

    <aura:attribute name="showErrors" type="String"/>

    <aura:attribute name="errorMessage" type="String"/>

    <aura:attribute name="message" type="String"/>

{!v.message}

    <aura:if isTrue="{!v.showErrors}">       

        <div class="slds-notify slds-notify_toast slds-theme_error">

            <span class="slds-assistive-text">error</span>

            <div class="slds-notify__content">

                <p class="slds-align_absolute-center">{!v.errorMessage}</p>                

            </div>

        </div>

    </aura:if>

</aura:component>


JS:

({

    callServer : function(component,event, helper) {

        var myAttribute = component.get("v.recordId");

        var action = component.get("c.ApexMethod1");

        action.setParams({ "id" : myAttribute });

        var action2 = component.get("c.ApexMethod2");

        action2.setParams({ "id" : myAttribute });


        action2.setCallback(this, function(response) {

            console.log(response.getState());

            if (response.getState() === "SUCCESS") {

                $A.get('e.force:refreshView').fire();           

            }else {

                console.log("Error Saving Contact ");

            }

        });

      

        action.setCallback(this, function(response) {

            if (response.getState() === "SUCCESS") {

                if (response.getReturnValue() == 1) {

                    component.set("v.showErrors",true);

                component.set("v.errorMessage","error!");

                } else {

                    component.set("v.message","process...");

                    $A.enqueueAction(action2);

                }

            }else {                  

                component.set("v.showErrors",true);

                component.set("v.errorMessage","error");

            }

        });

        $A.enqueueAction(action);

    },

    isRefreshed: function(component, event, helper) {

        location.reload();

    }

})


Apex:

Add @AuraEnabled to target ApexMethod

2021-02-24

2021-02-23

添付ファイルの保存先がSalesforce Filesにする

設定> Salesforce Files>一般設定


下記のチェックボックスをチェックする

レコードの [添付ファイル] 関連リストにアップロードしたファイルは、添付ファイルとしてではなく、Salesforce Files としてアップロードされます。


この設定に対しての説明:

※Salesforce Files は、ユーザが共有および管理できるように [ファイル] ホームに表示されます。一方、レコードへの添付ファイルはそのレコードからのみ使用できます。ファイルを添付ファイルではなく Salesforce Files としてアップロードすると、ファイルへのアクセス権が変更されません。特定のレコード以外でファイルを共有および管理できるようになるだけです。この設定は、Salesforce Classic にのみ適用されます。



その他

メモと添付ファイルの Lightning への移行

Salesforce LabsがMagic Moverアプリを提供しています。

記事のリンク先:https://help.salesforce.com/articleView?id=000315846&type=1&mode=1

きれいなタイルメニューを作成する|エクスペリエンス(旧コミュニティ)

タイルメニューを画面に追加する

エクスペリエンスビルダー>コンポーネント>コンテンツ>タイルメニュー

画面にDrag&Dropする



タイルメニューの内容を編集

「タイルメニューを編集」リンクをクリックする

メニュー項目を作成、削除、編集ができる。タイルメニュー項目に画像も追加できる。

メニュー項目を選択し、「省略可能」を開く、画像をアップロードで完了

※タイルメニューの画像がゲストコミュニティユーザに表示されるようにするには、[ワークスペース] | [管理] で [ゲストユーザは公開ページとログインページでアセットファイルを表示できる] を有効にします。次に、ドキュメントへの参照アクセス権を付与します。




タイルメニューのレイアウト調整

順番の調整はタイルメニューの並び順より変わる

画面テンプレートがサイドバーなしの場合は4個ずつで表示する、サイドバーありの場合は2個ずつで表示する

画像ありの場合、三つパータンがある。一部:文字バナーが表示される、画像を真ん中に小さく表示される;フル、オーバーレイなし:文字バナーが表示される、画像は拡大する;フル、オーバーレイあり:文字は真ん中に表示する、画像は拡大する

文字バナーの高さは15~100までとなる。これ以上変更したい場合はCSSで調整する

文字バナーの文字と背景色、タイルメニューの境界線の半径は変更できる



2021-02-19

エクスペリエンス(旧コミュニティ)の「ゲストユーザーのLightning権限」の設定

サイトの「ゲストユーザーのLightning権限」と別に、エクスペリエンス(旧コミュニティ)の「ゲストユーザーのLightning権限」設定です。


入り口はサイトではなく、ドメインです。

ドメイン> コミュニティの Force.com サブドメインのドメイン名をクリック>サイトの表示ラベルをクリック>設定画面


※この設定画面の「公開アクセス設定」ボタンからコミュニティWEBユーザのプロファイルをアクセスできる


Lighning Experience(旧community)的guest权限移除

 domian界面 》点击community的domain名》选择要设置的site,点击site表示名》进入设定界面

2021-02-15

Salesforce lwc: ApexFresh re-get wired data

@api recordId; 

recordList;


@wire(getDataMethod, {recordId : '$recordId'}

async recordList(value) {

    this.recordList = value;

    const {data, error} = value;

    if (data) {}

    else if (error) {}

}


handleClick(event) {

    refreshApex(this.recordList);

}