Looping through a SharePoint List to compare a field value with another List Item ID in Powershell

I have two Lists. A Calendar Lists and a Custom List
In one List I have multiple records all with an ‘EventID’ field which relates to a Calendar record (The record ID)

I am trying to use PowerShell to recurse through each Custom List record and check to see if the ‘EventID’ has a relating ‘Calendar ID’ in the Calendar record. If not, it means the Calendar entry has been deleted and the ‘Orphaned’ field in the Custom List record should be set to ‘YES’. There may be multiple records in the Custom List per Calendar Entry. I need to update ALL records WITHOUT a valid Calendar Entry to ‘Orphaned’.

Although not finished, so far I have this code, but I’m sure there must be a better way to do this, and a different way so that once a MISSING ‘EventID’ is found (the Calendar entry is deleted) then the loop stops and moves on to the next Calendar entry. My mind has just gone blank.

cls
#Add Snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

Start-Transcript -Path "D:SharePointScriptsEmailTranscript.txt"

#Set Variables
$spWeb = Get-SPWeb -Identity "http://ds.stylus.com"
$PClist = (Get-SPWeb "http://ds.stylus.com").Lists("PreventionCalendar")
$DElist = (Get-SPWeb "http://ds.stylus.com").Lists("DirectEngagement")
$DEvID = "EventID"
$DEvStatus = "Status"

#Get Today's Date - var: $now
$now = Get-Date 
Write-Host "Today is:" $now

$PCitems = $PClist.Items
#show the item count for the library
Write-Host "PreventionCalendar - Total Records: $($PCitems.count)"

$DEitems = $DElist.Items
#show the item count for the library
Write-Host "DirectEngagement - Total Records: $($DEitems.count)"

if($PCitems.count -lt 1)
{
    foreach($item in $DEitems)
    {   
       $DEID = $item.ID
       #Get the DE Status value
       $DEvStat = $item($DEvStatus)
       #Get the DE EventID value
       $DEvIDent = $item($DEvID)           
                
       Write-Host "PreventionCalendar is Empty. Orphan Appliance"
       $SPListItem = $DElist.GetItemById($DEID)
       $SPListItem("Status") = "Appliance Orphaned"
       $SPListItem.Update()
     }
}
elseif($PCitems.count -ge 1)
{

    foreach($item in $DEitems)
    {
        $DEID = $item.ID
        #Get the DE Status value
        $DEvStat = $item($DEvStatus)
        #Get the DE EventID value
        $DEvIDent = $item($DEvID) 

        Write-Host -Foregroundcolor Green "Checking..... Appliance ID:" $DEID "EventID:" $DEvIDent 

            foreach($item in $PCitems)
            {
                $PCID = $item.ID
                Write-Host -Foregroundcolor Red "IF 'EventID'" $DEvIDent "EQUALS 'CalendarID'" $PCID "run.." 
                
                if($DEvIDent -eq $PCID)
                {
                    Write-Host "Appliance ID:" $DEID "EventID:" $DevIDent "Matched with PreventionCalendar ID:" $PCID
                    {break}
                }
                else
                {
                    Write-Host "Appliance ID:" $DEID "EventID:" $DevIDent "PreventionCalendar ID: No Match Found"
                }
            }
            
        
        
                
     }          
                
                
}

Write-Host "Orphaned Appliances Updated"

Any help would be appreciated.

Rick

unable to copy WooCommerce checkout state field values from billing to shipping, or vice versa

I’m trying to modify the WooCommerce checkout display so that:

  1. Both field columns are open and expanded
  2. There is a checkbox under shipping address, which upon clicking, copies data over from the billing fields to the shipping fields.

I’ve got that part set up, but though the state data is copied over from one area to another, upon trying to place order, the error message of “Shipping State is a required field.
No shipping method has been selected.” is displayed.

I’m presuming that the data upon manually using the state select field is being recorded somewhere other than the DOM, which is why it’s not working?

Here’s my jQuery code that’s doing the copying:

<script type="text/javascript">
$("#ship-to-billing-address-checkbox").on("click", function(){
    // if (this.checked) {
        $("(name='shipping_first_name')").val($("(name='billing_first_name')").val());
        $("(name='shipping_last_name')").val($("(name='billing_last_name')").val());
        $("(name='shipping_address_1')").val($("(name='billing_address_1')").val());
        $("(name='shipping_address_2')").val($("(name='billing_address_2')").val());
        $("(name='shipping_city')").val($("(name='billing_city')").val());
        $("(id='select2-shipping_state-container')").text($("(id='select2-billing_state-container')").text());
        $("(name='shipping_postcode')").val($("(name='billing_postcode')").val());
        $("(name='shipping_country')").val($("(name='billing_country')").val());
});

If you want to see it in action, go to https://stage.chilwellness.com/checkout/?add-to-cart=12105. Enter your info in billing, click the checkbox, then you’ll see that though the state field seems entered, the label is still the color red, indicating that it’s needing data still.

theming – Theme a subscriber field in Simplenews issues

I need to address my subscribers in a more personal way. Thus I added fields for Mr./Mrs., firstname, lastname to the subscription block, and data gets collected nicely.
However, I can’t see how to theme these fields in simplenews-newsletter-body.html.twig.

In the header of this template there’s an example printing the subscriber’s (built-in) mail.

 {{ simplenews_subscriber.getMail  }}

Trying the same as {{ simplenews_subscriber.field_lastname }} doesn’t do anything. I tried a lot of variations to this approach, but to no avail.

What’s the secret of getting custom subscriber fields to print with Twig?

D8: Theming Subscriber Field in Simplenews Issues

I need to address my subscribers in a more personal way. Thus I added fields for Mr./Mrs., firstname, lastname to the subscription block, and data gets collected nicely.

However, I can’t see how to theme these fields in simplenews-newsletter-body.html.twig

In the header of this template there’s an example printing the subscriber’s (built-in) mail:

 {{ simplenews_subscriber.getMail  }}

But trying the same as {{ simplenews_subscriber.field_lastname }} doesn’t do anything. I tried a lot of variations to this approach, but to no avail.

What’s the secret of getting custom subscriber fields to print with TWIG?

8 – Migrating content from RSS feed to populate multiple Entity reference media field

In the Drupal 8 site I’m working on, I’ve currently set up some migration configurations which import content from an external RSS feed. The file urls references in this RSS feed are imported into the site as media entities and then referenced in the generated node. All is well, except for when there are multiple file urls.

So here is the configuration for the node import:

id: rss_innovations
label: 'Import Innovations feed'
status: true

source:
  plugin: url
  data_fetcher_plugin: http
  urls: 'https://www.innovationagencyexchange.org.uk/feeds/innovations'
  data_parser_plugin: simple_xml

  item_selector: /rss/channel/item
  fields:
    -
      name: guid
      label: GUID
      selector: guid
    -
      name: title
      label: Title
      selector: title
    -
      name: pub_date
      label: 'Publication date'
      selector: pubDate
    -
      name: link
      label: 'Origin link'
      selector: link
    -
      name: description
      label: Description
      selector: 'description'
    -
      name: image
      label: Image
      selector: 'featured_image'
    -
      name: content
      label: Content
      selector: 'content'
    -
      name: organisation
      label: Organisation
      selector: 'organisation'
    -
      name: ahsnid
      label: AHSN ID
      selector: 'ahsn'
    -

  ids:
    guid:
      type: string

  constants:
    file_destination: 'public://images/'

destination:
  plugin: 'entity:node'

process:
  title: title
  field_remote_url: link
  body/value: content
  body/format:
    plugin: default_value
    default_value: basic_html
  field_ahsn: ahsnid
  field_company: organisation
  field_introduction: description
  field_image:
    plugin: image_import
    source: image
    destination: 'constants/file_destination'
    alt: !title
  uid:
    plugin: default_value
    default_value: 17
  created:
    plugin: format_date
    from_format: 'D, d M Y H:i:s O'
    to_format: 'U'
    source: pub_date
  status:
    plugin: default_value
    default_value: 1
  type:
    plugin: default_value
    default_value: innovation
  field_media:
    plugin: migration_lookup
    migration: rss_resources_files
    source: guid
    no_stub: true

migration_dependencies:
  required:
    - rss_resources_files

And here is the configuration for the file importing:

id: rss_resources_files
label: 'Import Innovation files'
status: true

source:
  plugin: url
  data_fetcher_plugin: http
  urls: 'https://www.innovationagencyexchange.org.uk/feeds/innovations'
  data_parser_plugin: simple_xml

  item_selector: /rss/channel/item
  fields:
    -
      name: guid
      label: GUID
      selector: guid
    -
      name: resourcefile
      label: Resource file
      selector: 'file'

  ids:
    guid:
      type: string

  constants:
    file_destination: 'public://resources/'

process:
  field_media_file:
    -
      plugin: skip_on_empty
      method: row
      source: resourcefile
      message: 'No file found'
    -
      plugin: explode
      source: resourcefile
      delimiter: '|'
    -
      plugin: file_import
      destination: 'constants/file_destination'
destination:
  plugin: 'entity:media'
  default_bundle: file

So these both work at the moment in terms of importing all the content and all the files. All the files are imported files as file entities (using the plugin: file_import after the explode) but then only one media entity is generated per RSS item, so only one media entity per RSS item / node. Which makes sense as the file import is running separately to the entity media generation. I guess I need to use the sub_process plugin to generate the media entities? However when I try with that it only accepts associative arrays and the array from the explode plugin does not seem to be accepted by it. If someone could point me in the right direction I’d be ever so grateful!

This is an example of the RSS feed if needed:

<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.healthinnovationexchange.org.uk/feeds/innovations" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Innovations</title>
    <link>https://www.healthinnovationexchange.org.uk/feeds/innovations</link>
    <description></description>
    <language>en</language>
     <atom:link href="https://www.healthinnovationexchange.org.uk/feeds/innovations" rel="self" type="application/rss+xml" />
      <item>
    <title>Intelligent workforce solution and indoor location technology</title>
    <link>https://www.healthinnovationexchange.org.uk/%3Ca%20href%3D%22/solutions/intelligent-workforce-solution-and-indoor-location-technology%22%3Eview%3C/a%3E</link>
    <description><!(CDATA(Many have tried to change the way clinical teams work to be more efficient; but few have focused on optimising the supporting teams that provide the logistics which underpin the flow of patients throughout the hospital.&nbsp;Navenio has done just that. By looking at the teams working within a hospital, they have proven that knowing where people are, indoors in real-time, unlocks significant improvements in their workflow and efficiency. This improves patient flow and patient care. &nbsp;))></description>
     <pubDate>Wed, 10 Jun 2020 10:29:37 +0100</pubDate>
 <dc:creator />
 <guid isPermaLink="true">https://www.healthinnovationexchange.org.uk/%3Ca%20href%3D%22/solutions/intelligent-workforce-solution-and-indoor-location-technology%22%3Eview%3C/a%3E</guid><featured_image>https://www.healthinnovationexchange.org.uk/sites/default/files/FB6E45F5-4557-4027-9517-4E48C704E6A6_1.png</featured_image>
        <content><!(CDATA(<p style="text-align:justify"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt"><span style="color:black">Navenio has pioneered frictionless, accurate and robust indoor location solutions, built on award-winning science from the University of Oxford – enabled simply using sensors in existing smartphones. Unlike other RTLS, RFID, Bluetooth and Wi-Fi solutions, the Navenio technology </span></span><span style="font-size:14.0pt">requires <span style="color:black">no new investment in infrastructure</span> at all; is easily scalable and accurate to within 1 to 3 metres.</span></span></span></p><p style="text-align:justify"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">The Navenio solution is available in three forms:</span></span></span></p><ul><li style="text-align:justify; margin-left:8px"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">Intelligent Workforce Solution (IWS)</span></span></span><ul style="list-style-type:circle"><li style="margin-left:8px; text-align:justify"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">automates the prioritisation and allocation of tasks to ensure </span><span style="font-size:14.0pt">the right person is helping in the right location every time</span></span></span></li></ul></li><li style="text-align:justify; margin-left:8px"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">Location only solution</span></span></span><ul style="list-style-type:circle"><li style="margin-left:8px; text-align:justify"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">provides details of current and past movements of staff via their smartphones </span></span></span></li></ul></li><li style="text-align:justify; margin-left:8px"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">as a fully integrated location solution that feeds into other clinical/non-clinical solutions/applications</span></span></span><ul style="list-style-type:circle"><li style="margin-left:8px; text-align:justify"><span style="font-size:12pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:14.0pt">can provide valuable data to aid and improve patient consultations, discharge and referrals; and provide confirmation of where a staff member at infection risk has travelled between over a period of time</span></span></span></li></ul></li></ul>))></content>
    <organisation>Navenio Limited</organisation>
    <ahsn>2</ahsn>                                                                                                                                                                                                                                                                                     <video>https://www.navenio.com/dr-harpreet-sood</video>                        <file>https://www.healthinnovationexchange.org.uk/sites/default/files/Navenio%20Briefing%20Doc%20-%20Covid-19%20Assistance%20Briefing%20Doc%20-%2027mar20.pdf|https://www.healthinnovationexchange.org.uk/sites/default/files/AHSNsubmission%5B1%5DMT.pdf|https://www.healthinnovationexchange.org.uk/sites/default/files/Navenio%20IWS%204pp%20June%202020.pdf|https://www.healthinnovationexchange.org.uk/sites/default/files/Hospital%20Impact%20Study-MT-11.pdf</file>
</item>  
<item>
    <title>MediShout: A Logistical Brain For Healthcare </title>
    <link>https://www.healthinnovationexchange.org.uk/%3Ca%20href%3D%22/solutions/medishout-logistical-brain-healthcare%22%3Eview%3C/a%3E</link>
    <description><!(CDATA(www.MediShout.co.ukMediShout uses digital and AI technology to provide a “logistical brain” to health and social care organisations. Currently, logistical issues (e.g. faulty equipment, no PPE, broken IT, estates and facilities issues) delay staff and prevent best care. MediShout solves this problem by integrating all logistical departments onto one App, where a single-interface lets staff instantly report any non-clinical issue. Staff can track the progress of their report whilst organisations get operational oversight of all issues. AI-algorithms allows organisations to predict future problems, like broken equipment.))></description>
     <pubDate>Sat, 30 May 2020 08:32:37 +0100</pubDate>
 <dc:creator />
 <guid isPermaLink="true">https://www.healthinnovationexchange.org.uk/%3Ca%20href%3D%22/solutions/medishout-logistical-brain-healthcare%22%3Eview%3C/a%3E</guid>
        <content><!(CDATA(<p style="margin-bottom:11px"><strong>THE STORY:&nbsp;</strong><br>MediShout's founder is a surgeon and one afternoon, had to cancel three operations as a theatre lightbulb was broken. Staff had known for days but not reported it because no effective communication channels existed.</p><p style="margin-bottom:11px"><br><strong>THE HEALTHCARE PROBLEM:&nbsp;</strong><br>All clinicians are delayed daily by similar problems because healthcare buildings are poorly automated and not digitally connective. Staff get delayed by logistical and infra-structure problems e.g. forgotten passwords, broken equipment, low stock, lack of PPE.</p><p style="margin-bottom:11px"><br><strong>THE IMPACT IS HUGE:&nbsp;</strong><br>1. Journal of Nursing Times reported a third of NHS Nurses waste two hours per shift looking for equipment, costing the NHS almost £1billion annually.<br>2. There's been a 32% increase in cancelled NHS procedures due to equipment and staffing issues</p><p style="margin-bottom:11px"><br><strong>THE SOLUTION:&nbsp;</strong><br>MediShout is on the NHS Innovation Accelerator and provides the first platform in healthcare to integrate all logistical departments e.g. IT, estates, facilities, stock, equipment, suppliers. The MediShout App provides a single-interface for staff to instantly report any non-clinical issue. Staff can track the progress of their report whilst organisations get operational oversight and can see what issues are most impacting patient care and need fixing first. Artificial intelligence (AI) allows organisations to predict future problems, like broken equipment.</p><p style="margin-bottom:11px"><br><strong>BENEFITS:&nbsp;</strong><br>Health economists have shown MediShout can save NHS Trusts £1million annually (see attached report) and save 15 minutes per clinician daily. By sending staff reports directly to equipment suppliers, MediShout can improve output of surgical theatres and endoscopy departments.</p>))></content>
    <organisation>MediShout</organisation>
    <ahsn>2</ahsn>                                                                      <file>https://www.healthinnovationexchange.org.uk/sites/default/files/MediShout%20-%20Health%20Economic%20Impact%20Report%20%28HEE%29.pdf</file>
          </item>  </channel>
</rss>

sharepoint online – What search syntax can be used to return results where a user profile field is empty?

Working with SharePoint Modern and user profiles that have with category fields to populate with topics of interest.

I’ve set up a search results page for “pages for me” that refines results automatically, based on the value/s the user select/s for their ‘business area’, ‘product’ and other (4) categories that they’re interested in.

…AND {|Refinablestring123:{User.BusinessArea}} AND {|Refinablestring123:{User.Product}}…etc

This works fine, and returns results whether the user has selected one or a number of values in each category.

The problem arises when the user leaves the category field blank, either because they want to see all topics in that category, or that category is not relevant to them. The search results are empty due to the vacant field.

Is there a way to treat a blank category as “all values”?

Are there any know limitations on the date field, especially how old dates can be?

Our site needs a way to order a large number of posts (think +6000). After looking at some plugins I have decided to just use the date field since it is built into wordpress. It’s kind of silly, but it will meet our need and hopefully be compatible with any future iterations of the WordPress software or plugins.

Is there a limit to how far back in time posts can be dated? We shouldn’t have to go so far back, but I just wanted to check if anyone knew.

how to render more than field value in the controller

in my case i have a controller that it send for me the title , to the view , but i want to send the tittle and the body of the article both , i have tried to send them from the controller but it doesn’t work for me

how can i send them both from the controller (title and body) ?

here is tmy controller

 public function myPage() {
    $data = Drupal::service('myservice.ran');
    $dataService = $data->getArticles();
    return $this->renderMyPage($dataService);
  }
  function renderMyPage($articleObjects) {
    $articles = ();
    foreach ($articleObjects as $article) {
      $articles() = (
        '#type' => 'html_tag',
        '#html_tag' => 'h2',
        '#value' => ($article->title->value,$article->body->value),
        '#cache' => (
          'tags' => $article->getCacheTags(),
        ),
      );
    }
    return $articles;
  }

copy current date from ACF custom field and Automatically fill in other field

enter image description here

I’ve searched around a bit, and I’m having trouble finding an answer to this question. What I’m trying to do is automatically fill a custom field by the current date, all I want if I add multiple upcoming dates in ACF field, it can automatically change in other plugin time and date field automatically based on date automatically in WordPress the plugin name Video Conferencing with Zoom actually want add multiple dates in acf repeater field it will automatically update in plugin Video Conferencing with Zoom date and time field
is that possible anybody can help?