Execute mass update of cards in landing.block.updateCards

We are still updating this page

Some data may be missing here — we will complete it shortly.

Scope: landing

Who can execute the method: any user

The method landing.block.updateCards is used for mass updating cards in the block. It will return true on success, or an error.

Warning

  1. The method will completely remove the current cards in the block.
  2. This method is specific and is recommended for use only if your tasks cannot be solved by landing.block.updatenodes.

Parameters

Parameter

Description

lid
unknown

Page identifier.

block
unknown

Block identifier.

data
unknown

Array for modification. For clarification, see the example. Optionally, you can pass card presets.
Note that selectors are formed similarly to the method used in landing.block.updatenodes.

Examples

try
        {
        	const response = await $b24.callMethod(
        		'landing.block.updateCards',
        		{
        			lid: 2856,
        			block: 25458,
        			data: {
        				//affecting this card selector
        				// (other selectors can be passed simultaneously)
        				'.landing-block-card': {
        					//only this number of cards will remain, which
        					//will have only the specified nodes changed;
        					//the first card will be used for cloning
        					'values': [
        						{
        							'.landing-block-node-title': 'New title 0'
        						},
        						{
        							'.landing-block-node-title': 'New title 1'
        						},
        						{
        							'.landing-block-node-title': 'New title 2'
        						}
        					],
        					//optionally, you can apply card presets (key - card number starting from 0)
        					'presets': {
        						'1': 'preset_h2'
        					}
        				}
        			}
        		}
        	);
        	
        	const result = response.getData().result;
        	console.info(result);
        }
        catch(error)
        {
        	console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'landing.block.updateCards',
                    [
                        'lid'   => 2856,
                        'block' => 25458,
                        'data'  => [
                            '.landing-block-card' => [
                                'values'  => [
                                    [
                                        '.landing-block-node-title' => 'New title 0'
                                    ],
                                    [
                                        '.landing-block-node-title' => 'New title 1'
                                    ],
                                    [
                                        '.landing-block-node-title' => 'New title 2'
                                    ]
                                ],
                                'presets' => [
                                    '1' => 'preset_h2'
                                ]
                            ]
                        ]
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
            // Your required data processing logic
            processData($result);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error updating landing block cards: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'landing.block.updateCards',
            {
                lid: 2856,
                block: 25458,
                data: {
                    //affecting this card selector
                    // (other selectors can be passed simultaneously)
                    '.landing-block-card': {
                        //only this number of cards will remain, which
                        //will have only the specified nodes changed;
                        //the first card will be used for cloning
                        'values': [
                            {
                                '.landing-block-node-title': 'New title 0'
                            },
                            {
                                '.landing-block-node-title': 'New title 1'
                            },
                            {
                                '.landing-block-node-title': 'New title 2'
                            }
                        ],
                        //optionally, you can apply card presets (key - card number starting from 0)
                        'presets': {
                            '1': 'preset_h2'
                        }
                    }
                }
            },
            function(result)
            {
                if(result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.info(result.data());
                }
            }
        );
        

How to Use Examples in Documentation