[CSS]CSSのidとclassの使い分け[CSS]

CSSのidとclassの使い分け

HTML
<h1>こんにちは</h1>
<p class="red">私の名前は田中太郎です</p>
<h1>こんにちは</h1>
<p class="blue">私の名前は田中次郎です</p>
<p id="green">よろしくお願いします</p>

CSS
h1 {
  color: orange;
}
.red {
  color: red;
}
.blue {
  color: blue;
}
#green {
  color: green;
}

[Tools]wgetコマンドをWindowsで使う方法

wgetコマンドをWindowsで使う方法

wgetをダウンロードして解凍

上記のリンクへアクセスして、「Download」まで画面をスクロールします。「Binaries」と「Dependencies」の右側にある「Zip」をクリックします。するとこの2つのファイルをPCへダウンロードできます。

エクスプローラーを開いてPCからCドライブを開きます。Cドライブに新しいフォルダを作ります。フォルダの名前は自由に付けて大丈夫です。今回は「Tools」というフォルダを作ってみました。

新しいフォルダを作成出来たら、先ほどダウンロードした解凍した2つのフォルダを新しいフォルダに移動します。新しいフォルダにファイルを移動出来たら、「wget-1.11.4-1-bin」のフォルダの名前を「wget」に変更します。

次に、「wget-1.11.4-1-dep」の中の「bin」に入っている4つのファイルをコピーして、「wget」に名前を変更したフォルダの中の「bin」に移動します。

タスクバーに表示されている検索窓に「環境変数」と入力して検索します。検索結果から「環境変数を編集」をクリックして開きます。

Path」をクリックしてから「編集」をクリックします。

新規」をクリックします。「新規」をクリックします。「C:\Tools\wget\bin」と入力して「OK」をクリックします。これでwgetが利用できるようになりました。

コマンドプロンプトが開いたら、「wget」と入力してEnterキーを押します。wgetが起動すればインストールができています。

[Salesforce]System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, 非設定オブジェクトを更新した後の設定オブジェクト上の DML 操作 (またはその逆) は、許可されていません: Account、元のオブジェクト: User: [][Salesforce]

System.DmlException: Insert failed. First exception on row 0; first error: MIXED_DML_OPERATION, 非設定オブジェクトを更新した後の設定オブジェクト上の DML 操作 (またはその逆) は、許可されていません: Account、元のオブジェクト: User: [][Salesforce]

対策案

・対応前

@isTest
private class TestRunAs {
   public static testMethod void testRunAs() {
        // Setup test data
        // Create a unique UserName
        String uniqueUserName = 'standarduser' + DateTime.now().getTime() + '@testorg.com';
        // This code runs as the system user
        Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
        EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
        LocaleSidKey='en_US', ProfileId = p.Id,
        TimeZoneSidKey='America/Los_Angeles',
         UserName=uniqueUserName);

        System.runAs(u) {
              // The following code runs as user 'u'
              System.debug('Current User: ' + UserInfo.getUserName());
              System.debug('Current Profile: ' + UserInfo.getProfileId());
          }
    }
}

対応後

@isTest
private class TestRunAs2 {

   public static testMethod void test2() {

      Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
      User u2 = new User(Alias = 'newUser', Email='newuser@testorg.com',
         EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
         LocaleSidKey='en_US', ProfileId = p.Id,
         TimeZoneSidKey='America/Los_Angeles', UserName='newuser@testorg.com');

      System.runAs(u2) {
         // The following code runs as user u2.
         System.debug('Current User: ' + UserInfo.getUserName());
         System.debug('Current Profile: ' + UserInfo.getProfileId());

         // The following code runs as user u3.
         User u3 = [SELECT Id FROM User WHERE UserName='newuser@testorg.com'];
         System.runAs(u3) {
            System.debug('Current User: ' + UserInfo.getUserName());
            System.debug('Current Profile: ' + UserInfo.getProfileId());
         }

         // Any additional code here would run as user u2.
      }
   }
}

[Salesforce]lightning-combobox

lightning-combobox

<template>
    <lightning-combobox
            name="progress"
            label="Status"
            value={value}
            placeholder="Select Progress"
            options={options}
            onchange={handleChange} ></lightning-combobox>

    <p>Selected value is: {value}</p>
</template>

import { LightningElement } from 'lwc';

export default class ComboboxBasic extends LightningElement {
    value = 'inProgress';

    get options() {
        return [
            { label: 'New', value: 'new' },
            { label: 'In Progress', value: 'inProgress' },
            { label: 'Finished', value: 'finished' },
        ];
    }

    handleChange(event) {
        this.value = event.detail.value;
    }
}

[Salesforce]Lightningコンポーネントライブラリの lightning-card

Lightningコンポーネントライブラリの lightning-card

cardとは?

コンテナです。 タイトル、アクション、フッタを持たせることができます

例)

<template>
    <lightning-card>カードです</lightning-card>
</template>

[Salesforce]Lightning Web Component Basic

Lightning Web Component Basic

Javascript

import { LightningElement } from 'lwc';

export default class App extends LightningElement {
   name = 'Electra X4';
   description = 'A sweet bike built for comfort.';
   category = 'Mountain';
   material = 'Steel';
   price = '$2,700';
   pictureUrl = 'https://s3-us-west-1.amazonaws.com/sfdc-demo/ebikes/electrax4.jpg';
   ready = false;

   connectedCallback() {
       setTimeout(() => {
           this.ready = true;
       }, 3000);
   }
}

Html

<template>
    <div>
        <div>Name: {name}</div>
        <div>Description: {description}</div>
        <div>Category: {category}</div>
        <div>Material: {material}</div>
        <div>Price: {price}</div>
        <div><img src={pictureUrl}/></div>
    </div>
</template>

xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <!-- The apiVersion may need to be increased for the current release -->
    <apiVersion>48.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

Result

[Salesforce]Long running operation did not complete, continued in background

Long running operation did not complete, continued in background

I am debugging a apex trigger/class and is using the Developer Console. When I click on my log entry it seems like it loads the logs and then I get this popup:

enter image description here

You need to manually download the logs. Go to ‘File’ then ‘Download Log’.

enter image description here

[Salesforce]Lightning Webコンポーネントの非デコレータ

Lightning Webコンポーネントの非デコレータ

// howToUseVariables.js
import { LightningElement } from 'lwc';

export default class HowToUseVariables extends LightningElement {
    name = 'プレーン太郎';
}

// howToUseVariables.html
<template>
    <lightning-card class="slds-m-around_small">
        (そのまま記述)
        <p>name : {name}</p>
    </lightning-card>   
</template>

//howToUseVariables.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>57.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        <target>lightning__HomePage</target>
    </targets>
</LightningComponentBundle>

動作確認